Skip first line of fgetcsv method
try:
$flag = true;
while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE) {
if($flag) { $flag = false; continue; }
// rest of your code
}
Before beginning the while loop, just get the first line and do nothing with it. This way the logic to test if it's the first line is not needed.
fgetcsv($file, 10000, ",");
while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE) {
//....
}