function get_emails ($str)
{
$emails = array();
preg_match_all("/\b\w+\@\w+[\.\w+]+\b/", $str, $output);
foreach($output[0] as $email) array_push ($emails, strtolower($email));
if (count ($emails) >= 1) return $emails;
else return false;
}
# Here is how to use it.
# Sample string containing email addresses;
$str = "test test@test.com ha ha heHe@test.com bla bla bla@test.com";
# Get the emails on arrays;
$emails = get_emails ($str);
# Print that arrays;
print_r ($emails);
?>