Bug #13269 Updated: References and Arrays

From: Date: Fri, 14 Dec 2001 19:33:14 +0000
Subject: Bug #13269 Updated: References and Arrays
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-73813@lists.php.net to get a copy of this message
ID: 13269 Updated by: yohgaki Reported By: leonhard.holz@t-online.de Old Status: Open Status: Closed Bug Type: Scripting Engine problem Operating System: Win98 PHP Version: 4.0.5 New Comment: It works for me. I guess this is fixed. Previous Comments: ------------------------------------------------------------------------ [2001-09-12 14:49:47] leonhard.holz@t-online.de Another way of the references & array problem that shows up while copying arrays: <? $aArray = Array(); $aArray["test"] = "Hello World!"; $rRef = &$aArray["test"]; echo $rRef."<br>"; $aArray2 = Array(); $aArray2["test"] = "Hello World 2!"; $aArray = $aArray2; echo $aArray["test"]."<br>"; echo $rRef; ?> The last echo should return "Hello World 2!" but it doesnt. A workaround is to copy the arrays per key: <? while (list($key) = each($aArray2)) { $aArray[$key] = $aArray2[$key]; } ?> then all is ok. ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13269&edit=1

« previous php.dev (#73813) next »