Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function generatePassword($maxString = 10, $allowLettersAndNumbers = true) {
- $passwordGenerated = "";
- $alphabet = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz012345679";
- while ($maxString > 0) {
- $randomNumber = rand(0, 60);
- $splitAlphabet = explode(' ', $alphabet);
- $passwordGenerated .= $splitAlphabet[0][$randomNumber];
- $maxString--;
- }
- return $passwordGenerated;
- }
- echo "A senha gerada foi: " . generatePassword(18);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement