note 74561 deleted from ref.array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 19:28:53 +0000 |
| Subject: | note 74561 deleted from ref.array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134526@lists.php.net to get a copy of this message | ||
Note Submitter: psbrogna at yahoo dot com
----
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).