When using fgetcsv to parse CSV files under PHP, you will run into problems when CSV files have been created on a Mac, as line endings are incorrectly interpreted.

Use this before opening the file.

ini_set(‚auto_detect_line_endings‘,TRUE);
$handle = fopen(‚file‘,’r‘);