Created
April 10, 2011 11:00
-
-
Save chestergrant/912248 to your computer and use it in GitHub Desktop.
Word Descrambler - PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$arr = keypadsArr("h,e,s,s,c"); | |
echo "Created by: Chester Grant \n"; | |
echo "Purpose: Unscrambles letters(see line 199)\n"; | |
echo "Date: 9th/04/2011\n"; | |
combination("",0,$arr); | |
function combination($output,$pos,$dataSet){ | |
if($pos == count($dataSet)){ | |
echo $output."\n"; | |
return; | |
} | |
for($i=0; $i < count($dataSet);$i++){ | |
$ltr = $dataSet[$i]; | |
if(substr_count($output,$ltr)<substr_count(implode($dataSet),$ltr )){ | |
$new_output = $output.$dataSet[$i]; | |
combination($new_output,$pos+1,$dataSet); | |
} | |
} | |
} | |
function keypadsArr($str){ | |
return $arr1= explode(",",$str); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment