note 92346 deleted from function.array-merge by salathe
| From: | salathe@php.net | Date: | Mon, 06 Sep 2021 22:46:04 +0000 |
| Subject: | note 92346 deleted from function.array-merge by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216902@lists.php.net to get a copy of this message | ||
Note Submitter: enaeseth at gmail dot com
----
In both PHP 4 and 5, array_merge preserves references in array values. For example:
<?php
$foo = 12;
$array = array("foo" => &$foo);
$merged_array = array_merge($array, array("bar" => "baz"));
$merged_array["foo"] = 24;
assert($foo === 24); // works just fine
?>