09-23-2010, 03:25 PM
|
#1 (permalink)
|
|
The Contributor
Join Date: Nov 2007
Posts: 41
Thanks: 24
|
looping through the alphabet
I'm trying to mess around with arrays right now relating to letters in the alphabet. Is there anyway to code this better:
PHP Code:
<?php
header("Content-type: text/plain");
$arr = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
for ($t=0; $t<26; $t++){
for ($t1=0; $t1<26; $t1++){
if(($arr[$t].$arr[$t1]) == "MA"){
for ($t2=0; $t2<26; $t2++){
echo $arr[$t].$arr[$t1].$arr[$t2]. "\n";
}
}else{
echo $arr[$t].$arr[$t1]. "\n";
}
}
}
__________________
"Things you can get access to, you should never memorize." -Albert Einstein
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
|
|
|
|