How to make an expression in the operator if c &&, so that each expression is checked, and not just the first part? if (false && true) - checks only the first part and returns false. Assume:

if (empty($login) && empty($email)) {$error = 'Поля не должны быть пустыми.';} 

With a full login and empty email, it gives false. How to write to login and email checked?

    2 answers 2

    So you need to OR use))

     if (empty($login) || empty($email)) {$error = 'Поля не должны быть пустыми.';} 
    • Here I am stupid!)) Thank you - Vlad
    • @Vlad, if the answer has solved the problem, and it suits you, close the question - Vasily Barbashev
    • I'll figure out how to close here)) - Vlad

    Let me do my bit.
    In PHP 0, NULL, EMPTY, "" in IF returns FALSE, therefore we simplify:

     if( !$login || !$email ) $error = 'Поля не должны быть пустыми.'; 
    • Live and learn)) Thank you - Vlad