3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $times = array( '7:30pm', '2:00pm', '8:00pm', ); sort($times); print_r($times); $results = array(array()); foreach ($times as $time_range) { foreach ($results as $combination) { array_push($results, array_merge(array($time_range), $combination)); } } print_r($results);
based on NLYgg
Output for 4.3.0 - 7.2.0
Array ( [0] => 2:00pm [1] => 7:30pm [2] => 8:00pm ) Array ( [0] => Array ( ) [1] => Array ( [0] => 2:00pm ) [2] => Array ( [0] => 7:30pm ) [3] => Array ( [0] => 7:30pm [1] => 2:00pm ) [4] => Array ( [0] => 8:00pm ) [5] => Array ( [0] => 8:00pm [1] => 2:00pm ) [6] => Array ( [0] => 8:00pm [1] => 7:30pm ) [7] => Array ( [0] => 8:00pm [1] => 7:30pm [2] => 2:00pm ) )