Question : PHP code that randomize number or letters combination

I need PHP randomize function or code for my newsletter confirmation page..
do you know one?
Related Solutions: PHP Newsletter table

Answer : PHP code that randomize number or letters combination

Try the attached. You can vary the size of the result string as well as the letters that appear in it
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
// 009 Generate a near unique, non-sequential code
     //
     // Parameters: $codeSize - The size of the code to generate. Longer is more secure
     //             $codeChars - The set of characters to use to generate the key
     //
     // Returns: A simple string
     //
     function nearUniqueCode( $codeSize = 10, $codeChars= "" ) {
          $code  = "";
          $chars = ($codeChars != "" ) ? $codeChars : "abcdefghjkmnopqrstuvwxyzABCDEFGHJKLMNPQRTUVWXYZ0123456789";
          $chLen = strlen( $chars );


          // Build the code
          //
          for ( $i=0; $i < $codeSize; $i++ ) {
               $pos =  mt_rand(0, $chLen-1);
               $code .= substr( $chars, $pos, 1 );
          }

          return $code;
     }
Random Solutions  
 
programming4us programming4us