Small php snippet to generate a random string. Simple php function to generate random key/salt for encryption in php.
function randomString($length) {
$allchars = array_merge( range('a','z'), range('A', 'Z'),range(0,9));
$allchars = implode("", $allchars);
return substr(str_shuffle($allchars), 0, $length);
}
function randomString($length) {
$allchars = array_merge( range('a','z'), range('A', 'Z'),range(0,9));
$allchars = implode("", $allchars);
return substr(str_shuffle($allchars), 0, $length);
}
No comments:
Post a Comment