3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = 'ABC1'; permute(str_split($str), 0, strlen($str)); function permute($arr, $i, $n) { if ($i == $n) { printArray($arr); return; } for ($j = $i; $j < $n; $j += 1) { swapArrayValues($arr, $i, $j); permute($arr, $i + 1, $n); swapArrayValues($arr, $i, $j); } } function swapArrayValues(&$array, $i, $j) { $tmp = $array[$i]; $array[$i] = $array[$j]; $array[$j] = $tmp; } function printArray($arr) { echo implode($arr, ' ') . "\n"; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/DSo4D:30 Stack trace: #0 /in/DSo4D(30): implode(Array, ' ') #1 /in/DSo4D(11): printArray(Array) #2 /in/DSo4D(17): permute(Array, 4, 4) #3 /in/DSo4D(17): permute(Array, 3, 4) #4 /in/DSo4D(17): permute(Array, 2, 4) #5 /in/DSo4D(17): permute(Array, 1, 4) #6 /in/DSo4D(6): permute(Array, 0, 4) #7 {main} thrown in /in/DSo4D on line 30
Process exited with code 255.
Output for 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 A B C 1 Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 A B 1 C Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 A C B 1 Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 A C 1 B Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 A 1 C B Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 A 1 B C Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 B A C 1 Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 B A 1 C Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 B C A 1 Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 B C 1 A Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 B 1 C A Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 B 1 A C Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 C B A 1 Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 C B 1 A Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 C A B 1 Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 C A 1 B Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 C 1 A B Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 C 1 B A Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 1 B C A Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 1 B A C Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 1 C B A Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 1 C A B Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 1 A C B Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /in/DSo4D on line 30 1 A B C
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.26
A B C 1 A B 1 C A C B 1 A C 1 B A 1 C B A 1 B C B A C 1 B A 1 C B C A 1 B C 1 A B 1 C A B 1 A C C B A 1 C B 1 A C A B 1 C A 1 B C 1 A B C 1 B A 1 B C A 1 B A C 1 C B A 1 C A B 1 A C B 1 A B C
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: str_split() in /in/DSo4D on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: str_split() in /in/DSo4D on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: str_split() in /in/DSo4D on line 6

preferences:
319.03 ms | 401 KiB | 456 Q