3v4l.org

run code in 300+ PHP versions simultaneously
<?php $words=array("Casa", "perro", "abad"); print_r(getAllWordCombos($words)); function getAllWordCombos($words) { if (count($words)==1) return array($words); else if (count($words)==2) return array(array($words[0], $words[1]), array($words[1],$words[0])); else { $ret=array(); foreach($words as $i=>$firstword) { $cwords=array_slice($words,0); array_splice($cwords,$i); $combos=getAllWordCombos($cwords); $head=array($firstword); foreach ($combos as $combo) { $ret[]=array_merge($head,$combo); } } return $ret; } }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => perro [1] => Casa ) [1] => Array ( [0] => abad [1] => Casa [2] => perro ) [2] => Array ( [0] => abad [1] => perro [2] => Casa ) )

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:
39.92 ms | 402 KiB | 8 Q