Question
( Pls do number 6 and ignore number 5 . number 5 is just so you can know information about number 6) 5.For this exercise,
( Pls do number 6 and ignore number 5 . number 5 is just so you can know information about number 6)
5.For this exercise, you will use a list of ten of the largest cities in the world. (Please note, these are not the ten largest, just a selection of ten from the largest cities.) Create an array with the following values: Tokyo, Mexico City, New York City, Mumbai, Seoul, Shanghai, Lagos, Buenos Aires, Cairo, London.
Print these values to the browser separated by commas, using a loop to iterate over the array. Sort the array, then print the values to the browser in an unordered list, again using a loop.
Add the following cities to the array: Los Angeles, Calcutta, Osaka, Beijing. Sort the array again, and print it once more to the browser in an unordered list.
6. In this PHP exercise, you will again use the list of cities in Arrays Exercise #5. Here's the list, this time including countries as well as cities:
Tokyo, Japan; Mexico City, Mexico; New York City, USA; Mumbai, India; Seoul, Korea; Shanghai, China; Lagos, Nigeria; Buenos Aires, Argentina; Cairo, Egypt; London, England.
This time, create an associative array, using the countries as keys, the cities as values. Create a form for the user, with the instructions Please choose a city:
Follow this request with a select field for the 10 cities, with the options creates by looping through the array. When the user clicks the submit button, return the statement $city is in $country., where $city is the value chosen by the user, and $country is its key.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started