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]; $tempArray = $numbers; unset($tempArray[$i]); $tempArray = array_map('array_values', $tempArray); for($i = 0; $i < count($tempArray); $i++) { $combos[] = $baseNumber.$tempArray[$i].$tempArray[$i + 1]; $value = $tempArray[$i]; unset($tempArray[$i]); $numbers[] = $value; } } return $combos; } print_r(FindFamily(123));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: array_values(): Argument #1 ($array) must be of type array, string given in /in/T33a4:10 Stack trace: #0 [internal function]: array_values('2') #1 /in/T33a4(10): array_map('array_values', Array) #2 /in/T33a4(21): findFamily(123) #3 {main} thrown in /in/T33a4 on line 10
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.02 ms | 401 KiB | 8 Q