note 95795 deleted from function.array-merge by cmb
| From: | cmb@php.net | Date: | Mon, 19 Nov 2018 16:52:02 +0000 |
| Subject: | note 95795 deleted from function.array-merge by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209725@lists.php.net to get a copy of this message | ||
Note Submitter: riddlemd at gmail dot com
----
Apparently there is a shorthand that works very much like array_merge. I figured I would leave a
comment here, sense I saw it used in code but found nothing about it from google searches.
<?php
$array = array(
'name' => 'John Doe'
);
$array += array(
'address' => 'someplace somestreet'
);
echo $array['address']; // Outputs 'someplace somestreet'
?>
A difference from merge_array, it does NOT overwrite existing keys, regardless of key type.