- substr: documentation ( source)
- mt_rand: documentation ( source)
<?php
$str = mt_rand();
echo "mt_rand: $str";
function d($fn) {
global $str;
$str = $fn($str);
echo "$fn: $str\n";
}
function zxcvbn($l){
global $str;
d('md5');
d('metaphone');
d('sha1');
d('hex2bin');
d('bin2hex');
d('str_rot13');
d('str_shuffle');
d('strrev');
return substr($str, 0, $l);
}
echo zxcvbn(12);