Is there a way to check which part of an if statment is flase/true?
For example, I've got two variable $a and $b. If any of them is empty I want to stop my function, but i want also to echo a specific message for each one. My code is:
if(empty($a) || empty($b)){
if(empty($a)){echo('$a is empty');}
if(empty($b)){echo ('$b is empty');}
return;
}
Actually I've got many more variables and this is just a semplification. I would like to know if there is a way to avoid the double if check and to clean the code. Thank you
Aucun commentaire:
Enregistrer un commentaire