Check multiple variables empty or not

You can check the variables empty or not with the help o for each loop. We will declare the variables into an array and we will check the result is empty or not with the help of empty function

$a = "a";
$b = "f";
$c = "d";
$d = "";
$var = array($a,$b,$c,$d);
$valid = true;
foreach($var as $element) {
     // echo "empty";
    echo $element;

Leave a Reply

Your email address will not be published. Required fields are marked *