hello all
i am new to php.i don't know
how to use split function for separating multiple email addresses and storing in an array and then printing that each value of array...

if anybody can help me out then i will be thankful to him/her.

Recommended Answers

All 2 Replies

Well, to take the easier part first, the printing of each value of an array:

<?php
foreach($array as $key => $val){
echo "$key = $val <br />";
}

Now to separate email addresses, that depends on how the string with the email addresses is formatted. if it's just separated with comma's, I would use explode:

$array = explode(',', $emailString);

But if the separator between the email addresses isn't constant, you should indeed go with regex (with the split function).

Off course there are lots of ways of doing it. I think you could to do it with preg_match_all(); You should post an example of the string you want splitted looks like.

Thanks
ya you are right by this way

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.