Saturday, May 9, 2009

All 3 Letter Combinations - PHP Script

View Output



<?PHP

$arr = Array();

array_push($arr, "a");
array_push($arr, "b");
array_push($arr, "c");
array_push($arr, "d");
array_push($arr, "e");
array_push($arr, "f");
array_push($arr, "g");
array_push($arr, "h");
array_push($arr, "i");
array_push($arr, "j");
array_push($arr, "k");
array_push($arr, "l");
array_push($arr, "m");
array_push($arr, "n");
array_push($arr, "o");
array_push($arr, "p");
array_push($arr, "q");
array_push($arr, "r");
array_push($arr, "s");
array_push($arr, "t");
array_push($arr, "u");
array_push($arr, "v");
array_push($arr, "w");
array_push($arr, "x");
array_push($arr, "y");
array_push($arr, "z");

$results = Array();
foreach ( $arr as $three ) {
foreach ( $arr as $two ) {
foreach ( $arr as $one ) {
array_push($results, $three.$two.$one);
}
}
}

foreach( $results as $result ) {
echo " $result";
}

?>

3 comments:

Miguel said...

Thanks, just what I was looking for.

LxCBLOG said...

Hello,

I have a PHP script that creates all 4 letter combination with an array.

Check it out
http://lxcblog.com/2010/10/27/create-four-4-letter-domain-name-password-key-combination-php-array-script/

Boyd said...

thanks!

I ended up using range:

http://www.coderun.com.au/all-3-letter-combinations-list/