From the course: PHP for WordPress (2020)

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Challenge: Loop through an array of information

Challenge: Loop through an array of information - PHP Tutorial

From the course: PHP for WordPress (2020)

Challenge: Loop through an array of information

(upbeat music) - [Instructor] Now that you know a bit about loops, it's time for a challenge. Given the 2D array you see on the screen here, loop through it and display all of the content, each array on a single line. So you can see that we have an array of the Teenage Mutant Ninja Turtles and certain attributes about them like their color of their bandana, their weapon, and a descriptor. Your goal is to output the array like what you see on the screen here where each turtle's name is in bold and then there is a comma separated list of their attributes. Don't worry about the last comma. That's perfectly okay. That said there are a few bonuses. The first is to trim the last comma in each list, apply keys to the attributes to make each one a little clearer and add the attributes to a bulleted list instead of a comma separated one. Now this isn't a graded challenge, but these are a few extra things to think about…

Contents