Use a generator to loop through a complex CSV file to extract and modify required information.
- [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…using Google Maps, so I needed the latitude and longitude…
Author
Updated
9/24/2018Released
10/16/2017Note: The exercise files are free to all members. The code is commented to enhance your learning, but you will need database connectivity for some files to run as intended.
Skill Level Intermediate
Duration
Views
Related Courses
-
PHP: Design Patterns
with Keith Casey1h 9m Intermediate -
PHP: Managing Persistent Sessions
with David Powers2h 41m Intermediate -
PHP 7 New Features
with Kevin Skoglund1h 4m Intermediate
-
Introduction
-
Welcome1m 37s
-
-
1. Weekly Episodes
-
Array dereferencing4m 55s
-
Variable functions6m 8s
-
Unpacking arrays in PHP 7.17m 46s
-
Set a future date7m 40s
-
Block access to expired member10m 55s
-
Variable variables6m 47s
-
Select files for archiving9m 58s
-
Introducing PHP generators9m 33s
-
Creating a download link9m 45s
-
Merging arrays5m 57s
-
Strip accents from text9m 29s
-
Smart quotes and apostrophes7m 52s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Dynamically editing a CSV file