note 118917 deleted from function.array-merge by salathe
| From: | salathe@php.net | Date: | Mon, 06 Sep 2021 22:47:30 +0000 |
| Subject: | note 118917 deleted from function.array-merge by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216915@lists.php.net to get a copy of this message | ||
Note Submitter: kristopolous at yahoo dot com
----
I constantly forget the direction of array_merge so this is partially for me and partially for
people like me.
array_merge is a non-referential non-inplace right-reduction. For different ctrl-f typers, it's
reduce-right, side-effect free, idempotent, and non in-place.
ex:
$a = array_merge(['k' => 'a'], ['k' => 'b']) =>
['k' => 'b']
array_merge(['z' => 1], $a) => does not modify $a but returns ['k' =>
'b', 'z' => 1];
Hopefully this helps people that constant look this up such as myself.