I have two pretty big arrays with email addresses in them.
$oldmail
and $newmail
.
Both looks like this:
[0] => some@email.com
[1] => some1@email.com
[2] => some2@email.com
...
I want to find all the email values in $newmail
that does not exist anywhere in $oldmail
.
I think this should work:
foreach ($oldmail as $key => $value)
{
foreach ($newmail as $key2 => $value2)
{
if ($value == $value2)
{
//do nothing..
}
else
{
echo $value2;
}
}
}
But it is way to resource heavy with big lists.
Is there another more effecient way I can do this?