View Single Post
Old 04-24-2007, 05:45 PM   #9 (permalink)
mvl
formerly known as 'leo'
 
Last Online: Today 02:17 PM
iTrader: (12)
Join Date: Sep 2006
Posts: 661
DNF$: 100
Location: Netherlands
Country:


Re: How can I edit this script

I changed your code a little so it produces exactly what you want. Be patient, it will generate 456,976 domain names.

Quote:
Originally Posted by ccm View Post
Here's teh code for CVCV generator:

Code:
<?php

$consonants = array('b','c','d','f','g','h','j','k','l','m','n',  'p','q','r','s','t','v','w','x','y','z');
$vowels = array('a','e','i','o','u');

$letters=array_merge($consonants, $vowels);

$output .= '<pre>';
foreach ($letters as $a)
  foreach ($letters as $b)
    foreach ($letters as $c)
      foreach ($letters as $d)
        $output .= $a . $b . $c . $d . ".com\n";
echo $output . '</pre>';

?>
I just want to edit it for ALL 4 LLLL combos
Solution is to merge the $consonants and $vowels array and iterate over the elements of the resulting $letters array instead of the $consonants and $vowels arrays.

Maybe this is even better, because it doesn't consume as much memory:
Code:
<?php

$consonants = array('b','c','d','f','g','h','j','k','l','m','n',  'p','q','r','s','t','v','w','x','y','z');
$vowels = array('a','e','i','o','u');

$letters=array_merge($consonants, $vowels);

echo  '<pre>';
foreach ($letters as $a)
  foreach ($letters as $b)
    foreach ($letters as $c)
      foreach ($letters as $d)
        echo $a.$b.$c.$d.".com\n";
echo '</pre>';

?>
The difference is that the first script buffers all output until it has created all 456,976 possible domain names, needing memory to store them all. The second script outputs every domain as soon as it is constructed, only needing memory to store one domainname at a time.
__________________
HealthyDishes.com
SATAN.EU APPLICATIONS.EU REFERRAL(s).EU VOI.EU UUDD.COM

Last edited by mvl; 04-24-2007 at 05:53 PM.
mvl is online now   Reply With Quote