- array_filter: documentation ( source)
<?php
$var1= "";
$var2= "";
$var3= "3";
$temp_array = array($var1,$var2,$var3);
$temp_count =count(array_filter($temp_array));
if($temp_count ==1){
echo "1 variable is not empty";
}
else
{
echo "total variable is = ".$temp_count;
}