What are some common pitfalls when using the && operator in PHP form validation?

Using the && operator in PHP form validation can lead to unexpected behavior if not used correctly. One common pitfall is not properly encapsulating conditions within parentheses, which can result in unexpected evaluation order. To avoid this issue, always use parentheses to explicitly define the order of operations when using multiple && operators in form validation.

// Incorrect way of using && operator in form validation
if($username == 'admin' && $password == 'password' || $email == 'admin@example.com') {
    // Validation logic
}

// Correct way of using && operator in form validation
if(($username == 'admin' && $password == 'password') || $email == 'admin@example.com') {
    // Validation logic
}