Join David Powers for an in-depth discussion in this video Build nested unordered lists automatically, part of PHP Tips, Tricks, and Techniques.
- [Instructor] Hi, I'm David Powers,…and welcome to this week's edition…of PHP Tips and Tricks…designed to help you become a smarter…more productive PHP developer.…Building an HTML unordered list…from an indexed array is pretty basic.…One way to do it is with a foreach loop like this.…And there's the result.…All fairly straightforward.…But what about dealing with…a multidimensional associative array?…I've got one in this other file.…Nested lists present a much bigger challenge,…and that's what we'll tackle this week.…
If you want to follow along,…grab the download files that accompany this video.…To deal with a multidimensional array,…we're going to need a little bit of help…from the standard PHP library, or SPL.…A useful set of built-in PHP classes.…I've already started building the code…in this other file, ListBuilder.php.…It defines a custom class called ListBuilder…that extends the SPL's RecursiveIteratorIterator…that can loop recursively…over a structure such as a multidimensional array.…
I've defined two protected properties.…
Note: 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
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
New this Week:
1. Weekly Episodes
- 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.Cancel
Take 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.