Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- echo "all combination\n";
- function printAllCombinationsRecursive($prefix, $levelsLeft) {
- if ($levelsLeft==0)
- echo $prefix . '\n';
- else
- foreach ($letter in array={'a','b','c','d'}) {
- printAllCombinationsRecursive($prefix.$letter,$levelsLeft-1);
- }
- }
- function printAllCombinationsUpToLength($levels) {
- for ($i=1 $i<$levels; $i++} {
- printAllCombinationsRecursive("",$i);
- }
- }
- printAllCombinationsUpToLength(24);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement