note 107189 deleted from language.references by danbrown

From: Date: Sat, 14 Jan 2012 16:24:00 +0000
Subject: note 107189 deleted from language.references by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185657@lists.php.net to get a copy of this message
Note Submitter: vincent at delau dot nl ---- @krauth dot spam1 at gmail dot com 12-Jan-2012 09:19 Interesting side effect indeed, but you should be aware that the problem may also be arising in the assignment to the array. <?php echo "new PHP 5 style, ** remove all & assignments **:\n"; $objs = array(); foreach (array(37, "Wisconsin", 3.14159) as $i) { $a = new Gotcha($i); $objs[] = $a; } var_export($objs); echo "\n\n"; ?> This will work properly. There is no need to use reference assignments for object at all, they are always passed by reference. Not sure what causes the problem though.

« previous php.notes (#185657) next »