'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'alnum' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'numeric' => '0123456789', 'noZero' => '123456789', default => '', }; return substr(str_shuffle(str_repeat($pool, ceil($len / strlen($pool)))), 0, $len); case 'unique': case 'md5': return md5(uniqid(mt_rand())); case 'encrypt': case 'sha1': return sha1(uniqid(mt_rand(), true)); } return ''; } }