3v4l.org

run code in 300+ PHP versions simultaneously
<?php function findFamily($n) { $numbers = str_split("$n"); $combos = array(); $count = count($numbers); for($i = 0; $i < $count; $i++) { $baseNumber = $numbers[$i]; echo $i."\n"; $tempArray = $numbers; unset($tempArray[$i]); $tempArray = array_values($tempArray); $countTempArray = count($tempArray); for($i = 0; $i < $countTempArray; $i++) { $combos[] = $baseNumber.$tempArray[$i].$tempArray[$i + 1]; $value = $tempArray[$i]; unset($tempArray[$i]); $tempArray[] = $value; } } return $combos; } FindFamily(123);

preferences:
34.77 ms | 402 KiB | 5 Q