Grabbing E-mail Addresses by the Horns
Date: 04/10/06
(PHP Community) Keywords: no keywords
Okay... here's the problem.
I am trying to build a function that will read a string, find all of the @'s in said string, and then pull out and assign the e-mail addresses to a variable, stopping when it hits a space or a comma.
For example:
email1@get.me,email2@get.me,email3@get.me,email4@get.me
or:
email1@get.me email2@get.me email3@get.me email4@get.me
Does anyone know which functions I should start looking at first? I'm at a bit of a lose on something that seems very simple.
$email = preg_split("/[\s,]+/", $raw_email);
$i = 0;
$findme = "@";
$final_array = array();
$limit = count($email);
for($i;$i<$limit;$i++){
if(strpos($email[$i], $findme) === false){
}else{
$elist = array($email[$i]);
$final_array = array_merge($elist, $final_array);
}
}
Source: http://community.livejournal.com/php/437161.html