Exercises

  1. Create a multidimensional array of movies organized by genre. This should take the form of an associative array with genres as keys ("SF", "Action", "Romance", and so on). Each of this associative array’s elements should be an array containing movie names ("2001", "Alien", "Terminator", and so on).

  2. Loop through the array you created in exercise 1, outputting each genre and its associated movies to the browser.

Get Sams Teach Yourself PHP in 24 Hours, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.