title: Check if a string is an email address in PHP
body: <p>I am trying to do an SQL query, but I need to check somehow if the value is an email address.
  I need a way to check if <code>$user</code> is an email address, because I have user values such as this in my table.</p>
  
  <pre><code>test
  test2
  test@example.com
  test2@example.com
  test392
  test@example.net
  </code></pre>
  
  <p>and so on...</p>
  
  <p><strong>I need to make it so <code>$useremail</code> checks <code>$user</code> to find if it's an email address. So I can UPDATE the values, <code>WHERE user=test OR user=test@example.com</code>, etc.</strong></p>
  
  <pre><code>$user = strtolower($olduser);
  $useremail = "";
  
  mysql_query("UPDATE _$setprofile SET user=$sn, fc=$fc WHERE user='$user' OR user='$useremail");
  </code></pre>