Global objects?
Posted: Fri Jun 27, 2003 2:40 pm
This particular project is going on a server with PHP 4.0.6.
I have an error class that handles a my errors. I'm wanting to call a object that was instanciated outside an object, from inside an object, with out passing it in.
for example
This does not call the throwError method. Is there anyway to do what I'm trying to do.
Thanks in advance.
I have an error class that handles a my errors. I'm wanting to call a object that was instanciated outside an object, from inside an object, with out passing it in.
for example
Code: Select all
<?php
global $error;
$error = new Error();
class test
{
function foo()
{
$error->throwError();
}
}
$newTest = new test();
$newTest->foo();
?>Thanks in advance.