List Info

Thread: note 74561 added to ref.array




note 74561 added to ref.array
user name
2007-04-17 10:12:05
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  -- h
ttps://master.php.net/note/delete/74561/integrated
Del: useless     -- http
s://master.php.net/note/delete/74561/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/74561/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/74561
Reject      -- https://mast
er.php.net/note/reject/74561
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )