I quite often find myself with the need to pull the data from a CSV file into a system. This might be to fill out essential data like postcodes or to update a site with new content. What system I happen to be using dictates how I pull in the CSV file, but writing a quick parser is quite easy in PHP via the use of the fgetcsv() function.
Unfortunately, when using this function it is quite easy to miss something quite important and creates a quite useless piece of code. Take the following example. It appears to be fine at first glance, but the output of the code is always to run once and stop.