note 98973 deleted from function.array-merge by danbrown
| From: | danbrown@php.net | Date: | Mon, 19 Jul 2010 19:31:05 +0000 |
| Subject: | note 98973 deleted from function.array-merge by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170978@lists.php.net to get a copy of this message | ||
Note Submitter: daevid at daevid dot com
----
<?php
$data = array(1,2,3,4,5);
$lame = null;
// note that if you pass in null, you will null your whole array!! LAME!
$foo = array_merge($data, $lame);
var_dump($foo);
$foo = array_merge($lame, $data);
var_dump($foo);
// you must cast your values as an array to get the desired results.
$foo = array_merge($data, (array)$lame);
var_dump($foo);
?>