3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createCombinations($input_str, $length) { $input = str_split($input_str); foreach($input as $c) { if($length == 1) { yield $c; return; } else { foreach(createCombinations($input, $length -1) as $s) { yield $c + $s; return; } } } } $texte = "abcdefghijklmnopqrstuvwxyz0123456789"; foreach(createCombinations($texte, 4) as $result) { echo $result; }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: str_split(): Argument #1 ($string) must be of type string, array given in /in/PDafk:5 Stack trace: #0 /in/PDafk(5): str_split(Array) #1 /in/PDafk(13): createCombinations(Array, 3) #2 /in/PDafk(22): createCombinations('abcdefghijklmno...', 4) #3 {main} thrown in /in/PDafk on line 5
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:
41.6 ms | 401 KiB | 8 Q