Re: [PATCH] New functions: array_replace[_recursive]
| From: | Christian Schneider | Date: | Wed, 23 Jul 2008 12:11:08 +0000 |
| Subject: | Re: [PATCH] New functions: array_replace[_recursive] | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39223@lists.php.net to get a copy of this message | ||
Matt Wilmas wrote:
> array_replace() is like the + operator applied to arrays, except that it
> WILL overwrite ("replace") existing entries.
Excuse my ignorance but what's the difference between
$array = array_replace($array1, $array2);
and
$array = $array2 + $array1;
apart from different order of the entries in the resulting array?
> array_replace_recursive() will do the same except that it becomes
> recursive only when both the destination and source entries are
> arrays, otherwise the new source entry still replaces any existing
> one.
Hmm, generic enough to be included?
- Chris