I'm guessing that the issue you're having is an End of Line (EOL
) mismatch. Basically, the fgetcsv()
function breaks up a file based on a new-line character, but it's expecting a different character than the one that's being using the file (for instance, \n\r
vs \r
vs \n
). The result is that the function is just grabbing the first 1000
characters (as per the function call) and treating it as the first line, then it's grabbing the next 1000 character, etc... this would result in somewhat random outputs.
You might be able to try something like:
ini_set('auto_detect_line_endings', true);
before you grab the file. Or you could go through and manually modify the CSV to standardize the EOL characters/open the spreadsheet in a file-conversion which allows you to change the EOL character (i.e. Unix vs Windows