stristr and speed

piter

New Member
I've got two files,file a around 5mb, and file b around 66 mb. I need to find out if there's any occurnaces of the lines in file a, inside file b, and if so write them to file c.This is the way I'm currently handling it:\[code\]ini_set("memory_limit","1000M");set_time_limit(0);$small_list=file("a.csv");$big_list=file_get_contents("b.csv");$new_list="c.csv";$fh = fopen($new_list, 'a');foreach($small_list as $one_line){ if(stristr($big_list, $one_line) != FALSE) { fwrite($fh, $one_line); echo "record found: " . $one_line ."<br>"; } }\[/code\]The issue is its been running(successfully) for over an hour and its maybe 3,000 lines into the 160,000 in the smaller file. Any ideas?
 
Back
Top