Hi,
I have large list of email addressses from a file. It comes around 1 million email ids. I have list of bad words like spam,junk etc, it consist of 20,000+ bad words.
I need to validate email ids. If bad words is present any where in email id it will be marked as invalid.
For example;
testspam@gmail.com - invalid
newuser@desspam.com - invalid
I would like to know which will be fastest comparison method as array looping will take time.
I tried following methods, but this also takes time.
//$keyword_list- array of bad words;
//$check_key- the email id which need to validate
$arrays = array_chunk($keyword_list, 2000); for($i=0;$i<count($arrays);$i++) { if (preg_match('/'.implode('|', $arrays[$i]).'/', $check_key, $matches)){ return 1; } }
Please help me to find out best method considering perfomance of script.
Thanks,
Abhilash