I am writing in words: if variable1 is equal to variable2, and variable3 is empty, and variable4 contains data, then do it ...

How can what I wrote translate to PHP code?

    3 answers 3

    <?php $first = 1; $second = 1; $third = null; $fourth = "abcd"; if(($first === $second) && !(isset($third)) && !(empty($fourth))){ echo "OK"; } else { echo "error"; } ?> 

    Somehow, if I understood the question correctly.

       if( $p1 == $p2 && empty( $p3) && !empty( $p4) ) { // ура ура } 

      && logical AND , == equality check, empty () - check for empty value (there are some nuances!),! logical NOT , // line comment.

        if ($переменая1 == $переменая2 and $переменая3 == null and $переменая4 != null) { print ("action"); }

        Although, what is the "empty variable" - you need to clarify. Maybe isset .