note 74561 added to ref.array

From: Date: Tue, 17 Apr 2007 15:12:05 +0000
Subject: note 74561 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-125523@lists.php.net to get a copy of this message
Why is a deep copy function needed to move a sub array? I've just used the equality operator as in the code below. <?php $a= array( 'a'=>'apple', 'b'=>'banana', 'c'=>'cherry', 'subArray'=>array( 'A'=>'APPLE', 'B'=>'BANANA', 'C'=>'CHERRY' ) ); $a['copiedArray']= $a['subArray']; unset($a['subArray']); var_dump($a); ?> The above outputs the $a array with copiedArray being present and subArray gone. (php version: 4.4.0). ---- Server IP: 69.39.81.135 Probable Submitter: 208.49.239.226 ---- Manual Page -- http://www.php.net/manual/en/ref.array.php Edit -- https://master.php.net/note/edit/74561 Del: integrated -- https://master.php.net/note/delete/74561/integrated Del: useless -- https://master.php.net/note/delete/74561/useless Del: bad code -- https://master.php.net/note/delete/74561/bad+code Del: spam -- https://master.php.net/note/delete/74561/spam Del: non-english -- https://master.php.net/note/delete/74561/non-english Del: in docs -- https://master.php.net/note/delete/74561/in+docs Del: other reasons-- https://master.php.net/note/delete/74561 Reject -- https://master.php.net/note/reject/74561 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#125523) next »