<?php
$words=array("A", "B", "C", "D");
$combos=array();
print_r(getAllWordCombos($words,$combos, array()));
function getAllWordCombos($words, &$combos, $partial) {
if (count($words)==1) $combos[]=array_merge($partial,$words);
else {
foreach ($words as $i=>$first) {
$cwords=array_slice($words,0);
array_splice($cwords,$i,1);
getAllWordCombos($cwords, $combos, array_merge($partial,array($first));
}
}
}
- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
- Parse error: syntax error, unexpected ';' in /in/EIvFg on line 14
Process exited with code 255.
preferences:
175.61 ms | 1395 KiB | 60 Q