|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-09-16 10:09 UTC] sniper@php.net
[2005-09-16 17:25 UTC] dmitry@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 23:00:02 2025 UTC |
Description: ------------ Altering a subindex of a copy of an array alters the original array as well. Similar to bug#27381. Altering a root index does not exhibit this behaviour. Reproduce code: --------------- <?php $arr = array(1,2,3); $arr["foo"] = array(4,5,6); $copy = $arr; unset($copy["foo"][0]); print_r($arr); ?> Expected result: ---------------- Array ( [0] => 1 [1] => 2 [2] => 3 [foo] => Array ( [0] => 4 [1] => 5 [2] => 6 ) ) Actual result: -------------- Array ( [0] => 1 [1] => 2 [2] => 3 [foo] => Array ( [1] => 5 [2] => 6 ) )