jeudi 1 octobre 2015

PHP AND OR Condition with if else

I have a confusion, what is wrong here? if A & B or C is set it should print yes, otherwise it should print the error message

$a = 1;
$b = 2;
$c = null;

if ((is_null($a) && is_null($b)) || is_null($c)) {
    echo 'A and B or C cannot be blank.';
}
else
    echo 'yes';

here i have A & B assigned but still its printing 'A and B or C cannot be blank.'

To Make it more clear. A= Firstname, B=lastName, C=Email. so user should either give first name and last name otherwise email.

Aucun commentaire:

Enregistrer un commentaire