Guest User

Untitled

a guest
Dec 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2. if (!function_exists('randcomString')) {
  3. /**
  4. * @param number
  5. * @return string
  6. */
  7. function randcomString($length = 16)
  8. {
  9. $capital = substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 1);
  10. $small = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 1);
  11. $number = substr(str_shuffle('0123456789'), 0, 1);
  12. $special = substr(str_shuffle("!#$%&*+-<=>@_|"), 0, 1);
  13. $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&*+-<=>@_|';
  14. return substr(str_shuffle(str_repeat($pool, 5)), 0, $length - 4) . $capital . $small . $number . $special;
  15. }
  16. }
Add Comment
Please, Sign In to add comment