If You want to count your CSV File’s Column than do following, ini_set(“auto_detect_line_endings”, true); // where it holds the end of the line $file = ‘sample.csv’; $handle = fopen($file,’r’); $data = fgetcsv($handle, 1000, “,”); echo ‘ TOTAL COUNT ‘ . count($data) . PHP_EOL; // will give you the top header...Read more …