3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Enter your code here, enjoy! $array = array(); $array[] = array("foo" => 111, "bar" => 444); $array[] = array("foo" => 222, "bar" => 555); $array[] = array("foo" => 333, "bar" => 777); $array2 = array(); $array2[] = array('foobar' => 888, 'barfoo'=>999); $array2[] = array('barfoo' => 999, 'barfoo'=>1010); $array2[] = array('barfoo' => 1111, 'barfoo'=>1212); foreach( $array as $key=>$value){ echo $key."\t=>\t".$value['foo']."..."."\n"; } $array = array_merge($array, $array2); foreach( $array as $key=>$value){ echo $key."\t=>\t".$value['foo']."...".$value['barfoo']."\n"; } //echo var_dump($array);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
0 => 111... 1 => 222... 2 => 333... Warning: Undefined array key "barfoo" in /in/O2seG on line 24 0 => 111... Warning: Undefined array key "barfoo" in /in/O2seG on line 24 1 => 222... Warning: Undefined array key "barfoo" in /in/O2seG on line 24 2 => 333... Warning: Undefined array key "foo" in /in/O2seG on line 24 3 => ...999 Warning: Undefined array key "foo" in /in/O2seG on line 24 4 => ...1010 Warning: Undefined array key "foo" in /in/O2seG on line 24 5 => ...1212
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
0 => 111... 1 => 222... 2 => 333... Notice: Undefined index: barfoo in /in/O2seG on line 24 0 => 111... Notice: Undefined index: barfoo in /in/O2seG on line 24 1 => 222... Notice: Undefined index: barfoo in /in/O2seG on line 24 2 => 333... Notice: Undefined index: foo in /in/O2seG on line 24 3 => ...999 Notice: Undefined index: foo in /in/O2seG on line 24 4 => ...1010 Notice: Undefined index: foo in /in/O2seG on line 24 5 => ...1212
Output for 7.3.32 - 7.3.33
0 => 111... 1 => 222... 2 => 333... 0 => 111... 1 => 222... 2 => 333... 3 => ...999 4 => ...1010 5 => ...1212
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.1 - 5.1.6, 5.2.0 - 5.2.17
0 => 111... 1 => 222... 2 => 333... Notice: Undefined index: barfoo in /in/O2seG on line 24 0 => 111... Notice: Undefined index: barfoo in /in/O2seG on line 24 1 => 222... Notice: Undefined index: barfoo in /in/O2seG on line 24 2 => 333... Notice: Undefined index: foo in /in/O2seG on line 24 3 => ...999 Notice: Undefined index: foo in /in/O2seG on line 24 4 => ...1010 Notice: Undefined index: foo in /in/O2seG on line 24 5 => ...1212
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/O2seG on line 28
Process exited with code 255.

preferences:
256.98 ms | 401 KiB | 344 Q