3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(array(1, 2), array(3, 4), array(5)); function get_combinations($arrays) { $result = array(array()); $count = count($arrays); if($count > 2) { $array_merg = get_combinations(array_slice($arrays, 1)); } else { $array_merg = $arrays[1]; } print_r($arrays[0]); print_r($array_merg); $tmp = array(); foreach($arrays[0] as $arele1) { foreach($array_merg as $arele2) { if(is_array($arele2)) { $tmp[] = array_unshift($arele2,$arele1); } else { $tmp[] = array($arele1,$arele2); } } } print_r($tmp) return $tmp; } var_dump(get_combinations($a));
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'return' (T_RETURN) in /in/g6Zdc on line 27
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_RETURN in /in/g6Zdc on line 27
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_RETURN in /in/g6Zdc on line 27
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/g6Zdc on line 27
Process exited with code 255.