3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function MergeArrays($ar1, $ar2, $ar3) { $array = array(); $arrays = array('ar1', 'ar2', 'ar3'); foreach($arrays as $name) { //print_r($$name); foreach($$name as $id=>$value) $array[$id] = $value; } return $array; } $a1 = array('a', 'b'); $a2 = array('c', 'd', 'e'); $a3 = array('f'); print_r(MergeArrays($a, $a2, $a3));
Output for 5.6.30, 7.0.30 - 7.3.0alpha1
Notice: Undefined variable: a in /in/cv5d4 on line 19 Warning: Invalid argument supplied for foreach() in /in/cv5d4 on line 9 Array ( [0] => f [1] => d [2] => e )
Output for hhvm-3.22.0
Notice: Undefined variable: a in /in/cv5d4 on line -1 Warning: Invalid argument supplied for foreach() in /in/cv5d4 on line -1 Array ( [0] => f [1] => d [2] => e )
Output for hhvm-3.18.5 - 3.21.3
Notice: Undefined variable: a in /in/cv5d4 on line 19 Warning: Invalid argument supplied for foreach() in /in/cv5d4 on line 10 Array ( [0] => f [1] => d [2] => e )