Is it ok to loop array again in nested loop and also change the array?
I've an URL's array with entries(as array key) of either an URL or domain:example.com
In case of this entry : domain:example.com I want to remove all URLS containing example.com as domain:
foreach (array_keys($urls1) as $line) {
if (preg_match('/domain:(.*)/i', $line, $matches)) {
$domain = $matches[1];
foreach (array_keys($urls1) as $line2) {
if ($url_domains[$line2] == $domain) {
unset($urls1[$line2]);
}
}
}
}