Skip to content

Instantly share code, notes, and snippets.

@tototoshi
Last active August 29, 2015 13:59
Show Gist options
  • Save tototoshi/10626280 to your computer and use it in GitHub Desktop.
Save tototoshi/10626280 to your computer and use it in GitHub Desktop.
array_merge 怖い
<?php
/* !! 入力配列の中にある数値添字要素の添字の数値は、 結果の配列ではゼロから始まる連続した数値に置き換えられます。 */
$a = array(
'a' => 'aaa',
'100' => '100100100',
);
$b = array(
'b' => 'bbb',
);
var_dump(array_merge($a, $b));
/*
array(3) {
["a"]=>
string(3) "aaa"
[0]=>
string(9) "100100100"
["b"]=>
string(3) "bbb"
}
*/
@chocomelonchan
Copy link

まじかwwww

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment