|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-03-02 22:44 UTC] mchotai at fulcrum dot ca
Description:
------------
$userdata = array_merge($user, $userdata);
If $user is NULL the result is NULL instead of $userdata.
Test script:
---------------
$userdata = array("Hi", "Jim");
$userdata = array_merge(NULL, $userdata);
Expected result:
----------------
Get back $userdata = array("Hi", "Jim")
Actual result:
--------------
NULL
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
It also gives you a warning explaining that parameter 1 isn't an array. If you want your output, cast NULL to an array: var_dump(array_merge((array)NULL, array('a', 'b'))); array(2) { [0]=> string(1) "a" [1]=> string(1) "b" }