3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $k = (string)"0"; $a = array( 'name' => 'a', $k => 'null' ); $b = array( 'name' => 'b', $k => 'zero' ); $c = array( $k => 'zeronull', 'name' => 'c' ); var_dump($a); var_dump($b); var_dump($c); var_dump(array_merge($a, $b)); var_dump($a + $b); var_dump(array_merge($a, $c)); var_dump($a + $c); var_dump(array_merge($a, $b, $c)); var_dump($a + $b + $c);
Output for 4.3.0 - 7.1.0
array(2) { ["name"]=> string(1) "a" [0]=> string(4) "null" } array(2) { ["name"]=> string(1) "b" [0]=> string(4) "zero" } array(2) { [0]=> string(8) "zeronull" ["name"]=> string(1) "c" } array(3) { ["name"]=> string(1) "b" [0]=> string(4) "null" [1]=> string(4) "zero" } array(2) { ["name"]=> string(1) "a" [0]=> string(4) "null" } array(3) { ["name"]=> string(1) "c" [0]=> string(4) "null" [1]=> string(8) "zeronull" } array(2) { ["name"]=> string(1) "a" [0]=> string(4) "null" } array(4) { ["name"]=> string(1) "c" [0]=> string(4) "null" [1]=> string(4) "zero" [2]=> string(8) "zeronull" } array(2) { ["name"]=> string(1) "a" [0]=> string(4) "null" }