woolyg Posted September 24, 2007 Share Posted September 24, 2007 Hi all, Can anyone help me with this one? I have a list of email addresses in a variable. There could be 5, there could be 500, and they're all mixed around in no certain order.. $mailing_list = "mail1@mail.net, mail2@mail.net, mail3@mail.net, mail4@mail.net"; $arr = explode(", ",$mailing_list); is there a way to print $arr, specifically leaving out one of the email addresses? Say if I wanted to print everything in the $mailing_list contents EXCEPT mail2@mail.net, how would I go about it? All help appreciated. Woolyg Quote Link to comment https://forums.phpfreaks.com/topic/70444-printing-an-array-minus-certain-data/ Share on other sites More sharing options...
jitesh Posted September 24, 2007 Share Posted September 24, 2007 <?php $mailing_list = "mail1@mail.net, mail2@mail.net, mail3@mail.net, mail4@mail.net"; $mailing_list = str_replace(array("mail2@mail.net","mail3@mail.net",", ,"),"",$mailing_list); echo $mailing_list; ?> Quote Link to comment https://forums.phpfreaks.com/topic/70444-printing-an-array-minus-certain-data/#findComment-353876 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.