Page 1 of 1

extracting e-mail lists

Posted: Mon Jul 16, 2007 11:53 am
by eektech909
Is there a way to take a list of e-mail addresses (text1.txt) and remove all of them from a different list (text2.txt)?

Posted: Mon Jul 16, 2007 11:58 am
by Begby
Yes.

Have you tried anything yet? You have to open the files, parse the data into arrays, then remove the items that are in array1 from array2.

Posted: Mon Jul 16, 2007 12:19 pm
by ianhull
Try this,

Code: Select all


<?php

$email_arr1 = array("info@domain.com", "info@dominan.net");

$email_arr2 = array("info@domain.co.uk", "info@domain.net");

foreach($email_arr1 as $key => $val){
if (in_array($val, $email_arr2)) {
    echo "email matched: " . $val;
    //perform your removal
}
};

?>

Not tested but should work