I have to check,say 20 variables. & I'm really confused between these two approaches to check whether **all** of them are non-empty.

First one is your basic approach:

```
if($var1!= null && $var2!= null && $var3!= null && $var4!= null...) {
    // Do this
}

```

Second approach is by using array which I got from [here](http://forums.phpfreaks.com/topic/209955-check-that-multiple-variables-arent-empty/?p=1096057):

```
$vars = array('var1','var2','var3','var4');

$errors = array();         
foreach ($vars as $var => $label)
{
    if (isset($$var) && strlen($$var) == 0)
        $errors[$var] = $label . 'is empty';
}

if(is_array($errors) && count($errors) > 0)
{
    echo 'Please fix the following errors: ';
    echo '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
}
else
{   
        //Do this
}

```

Now, like I said earlier, the variables in my situation are around 20. Which approach(*If there are more, I would love to hear about them*) do you suggest would be better(*And more PHP-like if I may add*), if the number of variables are as small as 20?
Also, please be kind enough to explain as I'm still an newbee.

Thanks