3. Control Statements
Activity 3.1: Creating a Movie Listing Script to Print Movies per Director
Solution
The steps to complete the activity are as follows:
- Create an
activity-movies.php
script and add the following nested array, which contains five directors with a list of the five movies associated with them:<?php $directors = [ "Steven Spielberg" => ["The Terminal", "Minority Report", "Catch Me If You Can", "Lincoln", "Bridge of Spies"], "Christopher Nolan" => ["Dunkirk", "Interstellar", "The Dark Knight Rises", "Inception", "Memento"], "Martin Scorsese" => ["Silence", "Hugo", "Shutter Island", "The Departed", "Gangs of New York"], "Spike Lee" => ["Do the Right Thing", "Malcolm X", "Summer of Sam", "25th Hour", "Inside...