From: [EMAIL PROTECTED]
Operating system: Win98
PHP version: 4.0.5
PHP Bug Type: Scripting Engine problem
Bug description: References and Arrays
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 bug report at: http://bugs.php.net/?id=13269&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]