note 107189 added to language.references

From: Date: Fri, 13 Jan 2012 10:31:22 +0000
Subject: note 107189 added to language.references
Groups: php.notes 
Request: Send a blank email to php-notes+get-185629@lists.php.net to get a copy of this message
@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. ---- Server IP: 69.147.83.197 Probable Submitter: 89.184.168.160 ---- Manual Page -- http://www.php.net/manual/en/language.references.php Edit -- https://master.php.net/note/edit/107189 Del: integrated -- https://master.php.net/note/delete/107189/integrated Del: useless -- https://master.php.net/note/delete/107189/useless Del: bad code -- https://master.php.net/note/delete/107189/bad+code Del: spam -- https://master.php.net/note/delete/107189/spam Del: non-english -- https://master.php.net/note/delete/107189/non-english Del: in docs -- https://master.php.net/note/delete/107189/in+docs Del: other reasons-- https://master.php.net/note/delete/107189 Reject -- https://master.php.net/note/reject/107189 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185629) next »