Re: Parse a string containing name and email
| From: | Manuel Lemos | Date: | Sun, 07 Mar 2010 04:23:11 +0000 |
| Subject: | Re: Parse a string containing name and email | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-302587@lists.php.net to get a copy of this message | ||
Hello,
on 03/06/2010 11:34 PM Don said the following:
> Hi,
>
> I am pulling email values out of a database and the format is as follows:
>
> John Smith<john.smith@somedomain.com>
>
> I need to parse the string into two variables as such
>
> $name = John Smith
> $email = john.smith@somedomain.com
>
> What would be the easiest way to do this?
You may want to take a look at the MIME parser package. It comes with a
separate class name RFC 822 addresses that can be used exactly to parse
e-mail addresses in any valid format that may appear in message headers:
http://www.phpclasses.org/mimeparser
--
Regards,
Manuel Lemos
Find and post PHP jobs
http://www.phpclasses.org/jobs/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/