|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-22 00:04 UTC] derick@php.net
[2004-09-22 00:30 UTC] oliver at teqneers dot de
[2004-09-22 00:36 UTC] derick@php.net
[2004-09-22 00:42 UTC] oliver at teqneers dot de
[2004-09-22 00:52 UTC] derick@php.net
[2004-09-22 00:59 UTC] oliver at teqneers dot de
[2004-09-22 11:38 UTC] oliver at teqneers dot de
[2004-09-22 21:20 UTC] derick@php.net
[2004-09-23 11:42 UTC] oliver at teqneers dot de
[2004-09-23 14:46 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 16:00:02 2025 UTC |
Description: ------------ When I copy an array with a normal "=" the copy is not a real copy, but a reference to it. This only seems to happen to cascaded arrays. When an entry of the original array is unset, the copied entry will be unset as well. Reproduce code: --------------- $arr = array( 'in' => array(1,2,3) ); $copy = $arr; print_r($copy); unset( $arr['in'][1] ); print_r($copy); Expected result: ---------------- Array ( [in] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) Array ( [in] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) Actual result: -------------- Array ( [in] => Array ( [0] => 1 [1] => 2 [2] => 3 ) ) Array ( [in] => Array ( [0] => 1 [2] => 3 ) )