note 63159 deleted from language.types.array by nforbes
| From: | nforbes@php.net | Date: | Fri, 18 Aug 2006 21:59:28 +0000 |
| Subject: | note 63159 deleted from language.types.array by nforbes | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116050@lists.php.net to get a copy of this message | ||
Note Submitter: Henry Cesbron Lavau
----
To copy values from an array which contains arrays
db 05-Jan-2005 04:06 said : If you copy (=) an array which contains arrays it will be REFERENCED not
COPIED.
Well, this is only true since PHP 5.
Under PHP4, it is COPIED.
So be aware of this when porting code from PHP 4 to PHP 5 !
Now, if you want to copy the values (and not the references),
(instead of using array_diff as stated below, which won't work either under PHP 5)
just use :
$a2 = array_combine($a1, $a1);