This is very useful when developing because I can 'round up' all the errors
even when the script fails.
At the moment I am explicitly naming the objects in a shutdown function
and accessing them globally: Example
Expand|Select|Wrap|Line Numbers
- function shutdownFunc()
- {
- global $mysql;
- if(is_object($mysql))
- disconnectDB($mysql,$errorlist);
- global $mssql;
- if(is_object($mssql))
- disconnectDB($mssql,$errorlist);
- }
because diiferent objects are created..
I am now working on the idea of making shutdownFunc() a top-level class::method
used by all projects but this means finding all objects dynamically.
The closest I can think is using get_defined_vars() then is_object().
Is there a better way or even a better idea?