simonp Posted March 4, 2009 Share Posted March 4, 2009 Hi, I need to be able to split an e-mail address at the @ symbol eg input - "fred@bbc.co.uk" string1 = "fred" string2 = "bbc.co.uk" How would I go about that? Cheers Simon Quote Link to comment Share on other sites More sharing options...
Yesideez Posted March 4, 2009 Share Posted March 4, 2009 $arrEmail=explode('@',$email); This would make an array called $arrEmail $arrEmail[0] would be before the @ $arrEmail[1] would be everything after the @ EDIT: Or... You can do this as well if you don't want to use arrays... list($string1,$string2)=explode('@',$email); $string1 would be before the @ $string2 would be everything after the @ Quote Link to comment Share on other sites More sharing options...
simonp Posted March 4, 2009 Author Share Posted March 4, 2009 Thanks Yesideez - worked a treat Cheers Simon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.