Created
January 22, 2014 10:51
-
-
Save sdeluce/8556807 to your computer and use it in GitHub Desktop.
Génère une suite de caractères aléatoire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function generate_rand($l){ | |
| $c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
| srand((double)microtime()*1000000); | |
| for($i=0; $i<$l; $i++) { | |
| $rand.= $c[rand()%strlen($c)]; | |
| } | |
| return $rand; | |
| } | |
| echo generate_rand(10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment