$password = ""; for ($i = 0; $i < 8; $i++) { $password .= chr(rand(0, 25) + 97); } echo "Your password is: $password";