|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-12-14 14:33 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 02:00:01 2025 UTC |
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.