Re: Assign by reference...

From: Date: Tue, 13 Jun 2000 21:56:40 +0000
Subject: Re: Assign by reference...
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-1767@lists.php.net to get a copy of this message
On Tue, Jun 13, 2000 at 02:38:15PM -0700, Benjamin Berman wrote: > Both of these output "1,2". The same program could be written in java. > It is very natural in all three languages. My question is, can you do > it in PHP4? Yes, how about: class Obj { var $a; } $obj = new Obj(); $obj->a = 1; $arr[] = $obj; $obj = new Obj(); $obj->a = 2; $arr[] = $obj; while ($el = array_shift($arr)) echo $el->a; Stig -- Duct tape is like the force. It has a light side, and a dark side, and it holds the universe together ... -- Carl Zwanzig

« previous php.general (#1767) next »