Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. function generatePassword($maxString = 10, $allowLettersAndNumbers = true) {
  4. $passwordGenerated = "";
  5. $alphabet = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz012345679";
  6. while ($maxString > 0) {
  7. $randomNumber = rand(0, 60);
  8. $splitAlphabet = explode(' ', $alphabet);
  9. $passwordGenerated .= $splitAlphabet[0][$randomNumber];
  10. $maxString--;
  11. }
  12. return $passwordGenerated;
  13. }
  14.  
  15. echo "A senha gerada foi: " . generatePassword(18);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement