Advertisement
Guest User

Untitled

a guest
Jun 19th, 2015
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. $int = (isset($_GET['int']) && is_numeric($_GET['int']) && $_GET['int'] >= 3 && $_GET['int'] <= 9) ? $_GET['int'] : rand(3, 9);
  4. $strings = [];
  5. $abc = ['a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z'];
  6.  
  7. for($i = 1; $i <= $int; $i++) {
  8.     $strings[] = get_letter(rand(1, 10000), rand(0, 1) == 0 ? 0 : 1);
  9. }
  10.  
  11. function get_letter($i, $modus) {
  12.     global $abc;
  13.    
  14.     if($i > count($abc)-1) {
  15.         return get_letter($i-count($abc), $modus);
  16.     }
  17.    
  18.     return ($modus == 0) ? $abc[$i] : strtoupper($abc[$i]);
  19. }
  20.  
  21. $result = '';
  22.  
  23. foreach($strings as $string) {
  24.     $result .= $string;
  25. }
  26.  
  27. echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement