$a = file("a.csv",FILE_IGNORE_NEW_LINES);
$b = file("b.csv",FILE_IGNORE_NEW_LINES);
$fp = fopen('c.csv', 'w');
foreach(file("a.csv") as $var){
$l=str_getcsv($var);
if(in_array($l[0],$b))fputcsv($fp, $l);
}
fclose($fp);