title: Regex PHP - Validation of email address
body: <pre><code>function validateemail($email) {
  $v = "/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/";
  
  return (bool)preg_match($v, $email);
  }
  // check e-mail address, to see if it's a valid phone number
  if ($validateemail($email)) {
  $error = true;
  echo 'Invalid phone number!';
  }
  </code></pre>
  
  <p>I'm trying to check if an e-mail address is valid by the function <code>validateemail</code>, if it's an invalid phone number a message is displayed and <code>$error</code> is set to true. However I can't seem to get this code to work, there are no syntax errors as far as I know. Any advice would be appreciated.</p>
  
  <p>BTW - I know there are other ways to validate e-mail addresses, this is for a college project and for that purpose we have to use regex. </p>
  
  <p>Thanks in advance!</p>