I have two strings, one containing names separated by commas and the other containing email addresses separated by commas.
I now want my end result to replicate the behaviour as if I had gotten those values from the database with a:
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
echo $row['name'].'<br />'.$row['email'];
}
So I have for example these strings:
email1@domain.com,email2@domain.com,email3@domain.com
and
name1,name2,name3
And can then explode these into value arrays. Now, after exploding them,
I want to be able to make a loop where in each loop I can get $name[0]
and $email[0]
together, and $name[1]
and $email[1]
together, etc.
How can I merge the two arrays (after exploding them) and get the data for each datapair (name and email) in a loop?