note 82270 deleted from function.array-merge by danbrown
| From: | danbrown@php.net | Date: | Mon, 20 Jun 2011 15:25:38 +0000 |
| Subject: | note 82270 deleted from function.array-merge by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180760@lists.php.net to get a copy of this message | ||
Note Submitter: no at spam dot com
----
@Kevin Campbell:
Yep, be carefull....the docu is misleading....
$beginning = 'foo';
$end = array(0 => 'bar');
$result = array_merge((array)$beginning, (array)$end);
print_r($result);
will produce:
Array
(
[0] => foo
[1] => bar
)
whereas the
+ operator:
$beginning = 'foo';
$end = array(0 => 'bar');
$result = (array)$beginning + (array)$end;
print_r($result);
will produce:
Array
(
[0] => foo
)