3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php print_r(ordered_combinations(Array("one", "two", "three", "four"))); function ordered_combinations($array){ if(is_array($array)){ while(count($array) > 0){ foreach($array as $element){ $string = $string . " " . $element; $output[] = $string; } $string = ""; array_shift($array); } return $output; } }
Output for 5.0.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
Notice: Undefined variable: string in /in/iTQmF on line 9 Array ( [0] => one [1] => one two [2] => one two three [3] => one two three four [4] => two [5] => two three [6] => two three four [7] => three [8] => three four [9] => four )
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: string in /in/iTQmF on line 9 Array ( [0] => one [1] => one two [2] => one two three [3] => one two three four [4] => two [5] => two three [6] => two three four [7] => three [8] => three four [9] => four )