nuxy Posted December 7, 2007 Share Posted December 7, 2007 Hello, I'm trying to generate a listing of just random letters. I don't quite know how to explain this but, the output should be like this. a b .. z ab .. az ba .. bz .. zzzzzzzzzzzz Now here comes the second part. I would like to include numbers within the random letters, and a hypon. I'm trying to make this for a script that will list domain names. Examples: d0main 3xample google .. Because the internet won't allow me to simply list all the domain names there is(only com, net, org), I'll have to do this. So var I can only make weird unidentified figures. Can anyone assist me with this? Quote Link to comment Share on other sites More sharing options...
nuxy Posted December 7, 2007 Author Share Posted December 7, 2007 I forgot to give my current script. $chars = 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','0','1','2','3','4','5','6','7','8','9','0','-'); $num = 0; while(strlen($string) != count($chars)) { $string .= $chars[$num]; $num++; echo $string . '<br>'; } It works, but only for one sequence of "a", and also not with numbers within the words. Example: a ab abc abcd abcde abcdef abcdefg abcdefgh abcdefghi abcdefghij abcdefghijk abcdefghijkl abcdefghijklm abcdefghijklmn abcdefghijklmno abcdefghijklmnop abcdefghijklmnopq abcdefghijklmnopqr abcdefghijklmnopqrs abcdefghijklmnopqrst abcdefghijklmnopqrstu abcdefghijklmnopqrstuv abcdefghijklmnopqrstuvw abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwxy abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz0 abcdefghijklmnopqrstuvwxyz01 abcdefghijklmnopqrstuvwxyz012 abcdefghijklmnopqrstuvwxyz0123 abcdefghijklmnopqrstuvwxyz01234 abcdefghijklmnopqrstuvwxyz012345 abcdefghijklmnopqrstuvwxyz0123456 abcdefghijklmnopqrstuvwxyz01234567 abcdefghijklmnopqrstuvwxyz012345678 abcdefghijklmnopqrstuvwxyz0123456789 abcdefghijklmnopqrstuvwxyz01234567890 abcdefghijklmnopqrstuvwxyz01234567890- Quote Link to comment Share on other sites More sharing options...
Yesideez Posted December 7, 2007 Share Posted December 7, 2007 I think I understand what you're making - generating every combination of characters of x length. I wrote a program to do this in VB a few years ago and was amazed at how long this took when I got to 6 letters or more. Trying something like this in PHP I believe would eventually time out and fail - maybe someone else could shed some light on this? Quote Link to comment 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.