Jump to content

unicoart

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

unicoart's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. noup :'( , too many RAM memory consumption, i am open to ideas.....
  2. <?php function permutations($letters,$num){ $last = str_repeat($letters{0},$num); $result = array(); while($last != str_repeat(lastchar($letters),$num)){ $result[] = $last; $last = char_add($letters,$last,$num-1); } $result[] = $last; return $result; } function char_add($digits,$string,$char){ if($string{$char} <> lastchar($digits)){ $string{$char} = $digits{strpos($digits,$string{$char})+1}; return $string; }else{ $string = changeall($string,$digits{0},$char); return char_add($digits,$string,$char-1); } } function lastchar($string){ return $string{strlen($string)-1}; } function changeall($string,$char,$start = 0,$end = 0){ if($end == 0) $end = strlen($string)-1; for($i=$start;$i<=$end;$i++){ $string{$i} = $char; } return $string; } /* ************************************************* */ $mix = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9)); $mix = implode("", $mix); $Array=permutations($mix,2); for($i=0 ; $i < count($Array) ; $i++) { echo "$i." . $Array[$i] . "<BR>"; } ?> i think this will work
  3. Hi, i need to populate a mysql database with all alphanumerical combinations with length of 5(letters/numbers) So: $mix = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9)); 61^5 , i guess that would be 844 596 301 rows in table. can anybody help me with this snippet?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.