Question: I'm doing some validation now in PHP, and I'm running allot of conditional statements, for example:

```

if ($this->email->isValid($email))
return false;
if ($this->username->isValid($username))
return false;

```

ect.. 

Is there a nice way to do this? Or do I just run ten If statements like the ones above?
I can't use `switch` obviously, but I'm looking for that type of solution.. 

P.S... I'm using Zend Framework for validation

Answer: 
You could OR them like this:

```
if(cond1||
   cond2||
   cond3||
   cond4)
{
  return false;
}

```
Add all objects to an array and the iterate it (I guess you or Zend are using an interface "validator" or something like that each component (username, email, etc) implements the "isValid" method):

```
$validators = array();
$validators[] = $this->email;
$validators[] = $this->username;

foreach ($validators as $validator)
{
    if (!$validator->isValid())
    {
        return false;
    }
}

```