Hello i want to generate random string in php with repetition like Ag7hlA. is there anyway to do it i am trying this
<?php
function random_string($length)
{
$length = (int) $length;
if ($length < 1) return '';
$base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789";
$max = strlen($base) - 1;
$string = '';
while ($len--)
{
$string = $base[mt_rand(0, $max)];
}
return $string;
}
?>
But the random string is not being generated