3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array_1 = array('something1', 'foo'); $array_2 = array('something3', 'bar'); $array_3 = array(); $array_4 = array('something1', 'foobar'); $array_5 = "not an array"; foreach([$array_1,$array_2,$array_3,$array_4,$array_5] AS $array) { $final = array_merge((array)$array,(array)$final); }; print_r($final);
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: final in /in/u942D on line 9 Array ( [0] => not an array [1] => something1 [2] => foobar [3] => something3 [4] => bar [5] => something1 [6] => foo )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/u942D on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/u942D on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/u942D on line 8
Process exited with code 255.