Echo89

PHP Random Code Generator

Dec 23rd, 2012
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function random($size)
  2. {
  3.     $character_set_array = array();
  4.     $character_set_array[] = array('count' => $size, 'characters' => 'ab0cd1ef2gh3ij4kl5mn6op7qr8st9uvwxyz');
  5.     $temp_array = array();
  6.     foreach($character_set_array as $character_set)
  7.     {
  8.         for($i = 0; $i < $character_set['count']; $i++)
  9.         {
  10.             $temp_array[] = $character_set['characters'][rand(0, strlen($character_set['characters'])-1)];
  11.         }
  12.     }
  13.     shuffle( $temp_array );
  14.     return implode('', $temp_array);
  15. }
RAW Paste Data