You are here: Re: remove last part of email address « PHP Programming Language « IT news, forums, messages
Re: remove last part of email address

Posted by ZeldorBlat on 01/04/07 14:49

schwooba@gmail.com wrote:
> Is there a simple way to remove the last part of an email address using
> PHP. I want to remove the @ symbol and everything to the right of it.
> Any ideas?
>
> Example:
>
> thomas@xyz.com
>
> should be:
>
> thomas
>
> Thanks!

Someone here will inevitably suggest a regex, but that's overkill:

$email = 'foo@bar.com';
$username = substr($email, 0, strpos($email, '@'));

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация