I have one array with names(John, Suzy, Mary, June, ...)one with domains (@hotmail, @gmail, @yahoo, @tv, ...)and another one with email extensions(.com, .net, .co.uk...).
I have all these stored in db each in a different table. Im using a loop to get the values from db.
My problem is that Im using 3 loops in order to try the different possibilities for email. It is too slow and the page freezes. I know there must be a more practical and elegant way like using one of the inbuilt array functions. example "array_map"? Any help please guys.
foreach ($firstNames->data as $fn){
foreach ($domains->data as $d){
foreach ($emailExtensions->data as $de){
//add numbers to emails
for($n=0;$n<20;$n++){
$emails.= $fn['name'].$n.$d['domain'].$de['extension']." <br>";
//add dash before number
$emails.= $fn['name']."-".$n.$d['domain'].$de['extension']." <br>";
}
$emails.= $fn['name'].$d['domain'].$de['extension']." ".$is_valid." <br>";
}
}
}
echo "<h4> " . $emails. "</h4><br>";