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 - "[email protected]" string1 = "fred" string2 = "bbc.co.uk" How would I go about that? Cheers Simon Link to comment https://forums.phpfreaks.com/topic/147889-solved-split-an-e-mail-address/ 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 @ Link to comment https://forums.phpfreaks.com/topic/147889-solved-split-an-e-mail-address/#findComment-776190 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 Link to comment https://forums.phpfreaks.com/topic/147889-solved-split-an-e-mail-address/#findComment-776202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.