<?php

function validate_email ($email) {
  
//@see http://www.hm2k.com/posts/what-is-a-valid-email-address
  //@see http://hm2k.googlecode.com/svn/trunk/code/php/functions/validate_email.php
  
$regex='/^[\w!#$%&\'*+\/=?^`{|}~.-]+@(?:[a-z\d][a-z\d-]*(?:\.[a-z\d][a-z\d-]*)?)+\.(?:[a-z]+)$/iD';
  
  if (
preg_match($regex$email$m)) { return $m[0]; }
  return 
false;
}

/*

//example

var_dump(validate_email('bob@example.com'));

//expected result: string(15) "bob@example.com"

/**/