- intval: documentation ( source)
- rand: documentation ( source)
<?php
function quickRandom($length = 16) {
$length = intval($length, 10);
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$pool_length = 62;
$output = '';
while($length--) {
$output .= $pool[rand(0,$pool_length - 1)];
}
return $output;
}
echo strlen(quickRandom(311));