sandbudd Posted December 11, 2008 Share Posted December 11, 2008 I have a database where the email address are combined with the user name (this is not my doing) is there a php code that anyone knows that can separate these here is an example and thanks in advance. All of them have the -- before the actual email address. [email protected] Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/ Share on other sites More sharing options...
rhodesa Posted December 11, 2008 Share Posted December 11, 2008 $string = '[email protected]'; list($user,$email) = explode('--',$string); Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712825 Share on other sites More sharing options...
gevans Posted December 11, 2008 Share Posted December 11, 2008 Do you want to split them just for use?? if so you can do this; $foo = '[email][email protected][/email]'; $bar = explode('--',$foo); echo $bar[0];//username echo $bar[1];//email Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712827 Share on other sites More sharing options...
sandbudd Posted December 11, 2008 Author Share Posted December 11, 2008 will that remove everything except the email address? Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712831 Share on other sites More sharing options...
sandbudd Posted December 11, 2008 Author Share Posted December 11, 2008 there are over 2000 emails would I have to do this for each email? Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712832 Share on other sites More sharing options...
gevans Posted December 11, 2008 Share Posted December 11, 2008 no it will set variables with the email and username seperated Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712833 Share on other sites More sharing options...
sandbudd Posted December 11, 2008 Author Share Posted December 11, 2008 thanks but would I have to do this manually with each email? or just query the table row? Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712838 Share on other sites More sharing options...
gevans Posted December 11, 2008 Share Posted December 11, 2008 just use thats after you've queried the table Link to comment https://forums.phpfreaks.com/topic/136558-removing-from-email/#findComment-712843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.