dingus Posted January 22, 2008 Share Posted January 22, 2008 ok im stuck and its hard to describe the issue because if i could i would Google for it but here it is i basically need a simple peace of code to incroment by letters a b c d ... aa ab ac ad .... ba bb bc bd .. .. .. .. aaa aab .. aba abb basically i want it to generate a list like that (and i know it will end up as a big ass list and probably have memory issues at some point) but can some one please point me in the right direction? Quote Link to comment https://forums.phpfreaks.com/topic/87196-letter-counter/ Share on other sites More sharing options...
ratcateme Posted January 22, 2008 Share Posted January 22, 2008 You could make some code similar to this <?php //one letter $letter=0; while($letter<26){ echo $letters[$letter]."\n"; $letter++; } //two letters $letter=0; while($letter<26){ $letter_b=0; while($letter_b<26){ echo $letters[$letter].$letters[$letter_b]."\n"; $letter_b++; } $letter++; } ?> Scott Quote Link to comment https://forums.phpfreaks.com/topic/87196-letter-counter/#findComment-445970 Share on other sites More sharing options...
ratcateme Posted January 22, 2008 Share Posted January 22, 2008 sorry left out this $letters=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'); needs to be at the top of my code Quote Link to comment https://forums.phpfreaks.com/topic/87196-letter-counter/#findComment-445975 Share on other sites More sharing options...
dingus Posted January 22, 2008 Author Share Posted January 22, 2008 i didnt think of doing it that way however it works (and i assumed the array) i was going nuts with recursive functions calls and the like lol thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/87196-letter-counter/#findComment-445992 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.