Difference between "$object = new Class" and "$object =& new Class"
| From: | Tim Molendijk | Date: | Wed, 16 Oct 2002 03:34:16 +0000 |
| Subject: | Difference between "$object = new Class" and "$object =& new Class" | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-120100@lists.php.net to get a copy of this message | ||
Hi,
I'm using a 3rd pary debug class (ErrorHandler -
http://www.phpclasses.org/browse.html/package/345.html)
in this project I'm
working on. For this ErrorHandler class to work it just needs to be
instantiated at the beginning of a php file and it will catch the errors,
warnings and notices.
But I found out that this only functions when instantiating like this:
$errorH =& new ErrorHandler;
and it doesn't work when you do this:
$errorH = new ErrorHandler;
I find this very awkward because:
- I don't see the use of a reference when creating a new object.
- I don't see why it does NOT work when assigning the object while it DOES
work when assigning a reference to the object.
Does anyone have a clue why this could be happening?? I'm _very_ curious coz
I simply don't get it. 8[
Greetz,
Tim