3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = array('A','B','C'); permute($str, 0, count($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 git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/BLhGE:30 Stack trace: #0 /in/BLhGE(30): implode(Array, ' ') #1 /in/BLhGE(11): printArray(Array) #2 /in/BLhGE(17): permute(Array, 3, 3) #3 /in/BLhGE(17): permute(Array, 2, 3) #4 /in/BLhGE(17): permute(Array, 1, 3) #5 /in/BLhGE(6): permute(Array, 0, 3) #6 {main} thrown in /in/BLhGE on line 30
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:
35.9 ms | 402 KiB | 8 Q