From the course: PHP Tips, Tricks, and Techniques

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Dynamically editing a CSV file

Dynamically editing a CSV file

- [David] Hi, I'm David Powers and welcome to this week's edition of PHP Tips, Tricks and Techniques designed to help you become a smarter, more productive PHP developer. This time I'll show you how to edit a CSV file on the fly. It demonstrates a practical use of a generator. To use this technique your server needs to be running PHP 5.5 or later. If you're not familiar with generators, check out the previous edition of PHP Tips, Tricks and Techniques. In the exercise files for this video I've got this CSV file that I downloaded from DataSF, San Francisco's repository of open data. It contains details of nearly 1,400 off street parking lots in San Francisco. What I'm interested in is the address, which is in the second column, and in the location which is in the 10th column. Some of the addresses, like this one line five, are all in upper case and the location is a single string that contains both the latitude and the longitude. I was working on a project to display the locations…

Contents