11 lines
277 B
PHP
11 lines
277 B
PHP
<?php
|
|
function randstr($len,$chars=null) {
|
|
if (is_null($chars))
|
|
$chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_:;\'"%&/?^';
|
|
$charslen=strlen($chars)-1;
|
|
$str='';
|
|
for ($i=0; $i<$len; $i++)
|
|
$str.=$chars[mt_rand(0,$charslen)];
|
|
return($str);
|
|
}
|
|
?>
|