PHP has a really cool function called fgetcsv which provides a really simple way to read CSV data.  I used it in a script recently and it worked perfectly with my test data and then someone with with a Mac ran their data through it and it failed horribly.

It turns out you have to set the auto_detect_line_endings option to true BEFORE the fopen function for it to work.  If the call to ini_set occurs after the fopen it doesn't work correctly.