Re: Get reference count on a variable.

From: Date: Sat, 21 Aug 2004 15:21:51 +0000
Subject: Re: Get reference count on a variable.
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-194395@lists.php.net to get a copy of this message
* Thus wrote Robert Cummings: > > As exemplified in the sample script I sent in my last response and by > the link sent by Hannes Magnusson, in PHP5 the following have identical > behaviour: > > $o1 = new Foo(); > $o2 = $o1; > > // Is same as... > > $o1 = new Foo(); > $o2 =& $o1; But = and =& are not identical: <?php class foo { }; $a = new foo(); $b = $a; var_dump($b); /* object #1 */ $a = null; var_dump($b); /* object #1 */ $c = new foo(); $d = &$c; var_dump($d); /* object #2 */ $c = null; var_dump($d); /* NULL */ ?> Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#194395) next »