Anvar Freelance Web Designer and SEO Expert Logo
01 / 01
WhatsApp Logo +91 808 999 0405

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

<?php
$a = "a";
$b = "f";
$c = "d";
$d = "";
$var = array($a,$b,$c,$d);
$valid = true;
foreach($var as $element) {
 if(empty($element)){
     // echo "empty";
    $i++;
    }
  else{
    echo $element;
 }
by anvar
Published : Dec , 4

Post a comment

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