- str_shuffle: documentation ( source)
- array_rand: documentation ( source)
- range: documentation ( source)
- rand: documentation ( source)
<?php
function randomString()
{
$str = '';
$alpha = range('a', 'f');
$alphaCount = rand(25, 26);
for ($i = 0; $i < $alphaCount; $i++) {
$str .= $alpha[array_rand($alpha)];
}
$numCount = 64 - $alphaCount;
for ($i = 0; $i < $numCount; $i++) {
$str .= rand(0, 9);
}
return str_shuffle($str);
}
echo randomString();