Hits: 2271
<?phpfunction lower($n)
{
return( strtolower(str_replace(“ ”, “”, $n)) );
}
$string = "Hello Friends, I am Sandeep Verma. My Emails are infos@svnlabs.com, sandeepv @svnlabs.com, svnlab @ gmail.com and svmbm@ svnlabs.com. Do you know we can use this code to get emails from a PHP String. Also code is converting emails to proper case like Sandeepv @svnlabs.com and sandeepv@svnlabs.com are same. But contact me here infos@scriptrr.com";
preg_match_all("/[_a-z0-9-]+(\.[_a-z0-9-]+)*([ ]{0,2})@[a-z0-9- ]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})/i", $string, $matches);
$lower = array_map("lower", $matches[0]);
$result = array_unique($lower);
print_r($result);
?>
Output:
Array ( [0] => infos@svnlabs.com [1] => sandeepv@svnlabs.com [2] => svnlab@gmail.com [3] => svmbm@svnlabs.com [6] => infos@scriptrr.com )















