3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $root = array_map(function($v) { return 'cat'.$v; }, range(1,10)); //array( 1=>'cat1', 2=>'cat2', 3=>'cat3' ); $child_1 = array_map(function($v) { return 'sub_cat'.$v; },range(1,16)); //array( 1=>'sub_cat1', 2=>'sub_cat2', 3=>'sub_cat3' ); $child_2 = array_map(function($v) { return 'sub_sub_cat'.$v; },range(1.30)); //array( 1=>'sub_sub_cat1', 2=>'sub_sub_cat2', 3=>'sub_sub_cat3' ); function getAllCombinationsArray($source_arrays = array(), $kd = array(), $vd = array()){ $return = array(); foreach(array_shift($source_arrays) as $ck => $cv) { $kdi = $kd; array_push($kdi, $ck); $vdi = $vd; array_push($vdi, $cv); if(!empty($source_arrays)) { $return += getAllCombinationsArray($source_arrays, $kdi, $vdi); } else { $return[implode('_', $kdi)] = implode(' -> ', $vdi); } } return $return; } print_r(getAllCombinationsArray(array($root, $child_1, $child_2)));
based on Hodv3
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: range() expects at least 2 parameters, 1 given in /in/fMPqR on line 5 Warning: array_map(): Argument #2 should be an array in /in/fMPqR on line 5 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 10 Array ( )
Output for hhvm-3.12.0
Warning: range() expects at least 2 parameters, 1 given in /in/fMPqR on line 5 Warning: array_map(): Argument #2 should be an array or collection Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Warning: Invalid argument supplied for foreach() in /in/fMPqR on line 20 Array ( )
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/fMPqR on line 3
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 T_FUNCTION, expecting ')' in /in/fMPqR on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/fMPqR on line 3
Process exited with code 255.