Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!function_exists('randcomString')) {
- /**
- * @param number
- * @return string
- */
- function randcomString($length = 16)
- {
- $capital = substr(str_shuffle('ABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 1);
- $small = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz'), 0, 1);
- $number = substr(str_shuffle('0123456789'), 0, 1);
- $special = substr(str_shuffle("!#$%&*+-<=>@_|"), 0, 1);
- $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&*+-<=>@_|';
- return substr(str_shuffle(str_repeat($pool, 5)), 0, $length - 4) . $capital . $small . $number . $special;
- }
- }
Add Comment
Please, Sign In to add comment