$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$password = "";
for($i=0; $i<7; $i++){
$randNum = mt_rand(0, 61);
$password .= $chars[$randNum];
}
echo $password;
To change the length of the string simply edit the second number in the for loop.















