3v4l.org

run code in 500+ PHP versions simultaneously
<?php $temp = array("one","two","three","four","five"); $arrayResult = array(); for($i = 0; $i< count($temp); $i++){ for($j = 0; $j< count($temp) - $i; $j++){ $tempArr = $temp; $newArray[$i+1] = '*'; array_splice($tempArr,$j, $i+1,$newArray); $arrayResult [] = $tempArr; } } print_r($arrayResult);

preferences:
74.01 ms | 1712 KiB | 5 Q