title: Multiple Email Validation
body: <p>I'm trying to validate multiple email addresses separated by commas or just one email address depending on the user entry. </p>
  
  <p>I created this function:</p>
  
  <pre><code>function isEmailMultiple($address) 
          {
              $validate = array();
              if(strlen($address) &lt; 1)
                  {
                      return false;
                  }
  
              $emailAddresses = explode(",", $address);
              foreach($emailAddresses as $emailAdd)
                  {
                      $emailAdd = trim($emailAdd);
                      if (!preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])*(\.([a-z0-9])([-a-z0-9_-])([a-z0-9])+)*$/i', $emailAdd))
                          {
                              // if validation fails, add error to array
                              $validate[$emailAdd] = 1;
                          }
                  }
  
              if(count($validate) == 0)
                  {
                      // No errors added to the array
                      return true;        
                  } 
  
              else 
                  {           
                      return false;
                  }
          }
  </code></pre>
  
  <p>This is the implode function:</p>
  
  <pre><code>$headers .= 'BCC: '. implode(",", $emailfromform) . "\r\n";
  </code></pre>
  
  <p>and I'm getting this error: </p>
  
  <pre><code>Warning: implode() [function.implode]: Invalid arguments passed in. . .
  </code></pre>