mrkeck Sharing the Love

20Dec/120

PHP csv Not Recognizing Line End on Mac

//Fix mac line ending issue
ini_set("auto_detect_line_endings", true);
 
//put each line of the file into an array element
$lines = file('theFile.csv');

If I make the csv in Windows it works without the ini_set, but if I make it on a Mac, not so much...so I am going to set it in the php.ini when I do new setups, but for a quick fix ini_set

Filed under: mac, PHP No Comments