What are some common restrictions for passwords in PHP login scripts?

One common restriction for passwords in PHP login scripts is enforcing a minimum length requirement to ensure that passwords are strong and secure. This can be done by checking the length of the password input by the user and displaying an error message if it does not meet the minimum length requirement.

$password = $_POST['password'];

if(strlen($password) < 8) {
    echo "Password must be at least 8 characters long.";
    // Add code here to handle the error, such as redirecting back to the login page
} else {
    // Proceed with password validation and login logic
}