Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CodiceRandom() {
- $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
- $pass = array(); //remember to declare $pass as an array
- $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
- $n = rand(26, 51);
- $pass[] = $alphabet[$n];
- for ($i = 0; $i < 6; $i++) {
- $n = rand(0, $alphaLength);
- $pass[] = $alphabet[$n];
- }
- $n = rand(52, $alphaLength);
- $pass[] = $alphabet[$n];
- return implode($pass); //turn the array into a string
- }
Add Comment
Please, Sign In to add comment