Exercise Weekend

You know what's next! Time to practice.

  • In the PHP shell, create a dictionary of your own with 8 key-value pairs of words and definitions. Print it out using var_dump.
  • Continue in the PHP shell, and print out the third and sixth entries in the dictionary, in the format "The third word is X and it means Y."
  • Remove the second, fourth, sixth and eighth entries using unset.
  • Use a foreach loop to print out all the remaining keys.
  • Use a foreach loop to print out all the definitions, reversing the order of the letters with the strrev function.
  • Add 2 more words and definitions to your dictionary.
  • Use a foreach loop to print out all the keys and definitions in the browser. The keys should be displayed with <h1> tags and the values should be displayed with <h3> tags.
  • Let's say you're in a band which has a catalog of 4 albums. Create a page in the browser to display each album with a price next to it. Use an associative array with a foreach loop.
  • Let's add to your band's imaginary homepage. You are going to be playing 6 shows. Create an associative array to store the dates with the cities you will be playing in. Now use another foreach loop to display them in the browser underneath the albums and songs currently for sale.