note 123435 deleted from function.array-merge by cmb

From: Date: Fri, 14 Dec 2018 11:31:16 +0000
Subject: note 123435 deleted from function.array-merge by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209900@lists.php.net to get a copy of this message
Note Submitter: Nicolas A ---- Beware: $arr1 = [ '1' => 'a', '2' => 'b' ]; $arr2 = [ '5' => 'c', '6' => 'd' ]; $arr3 = array_merge($arr1, $arr2); Here, arr3 will contain $arr3 = [ 0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd' ] Despite all keys being strings. The fact that they can be casted as integers is enough for array_merge

« previous php.notes (#209900) next »