Workshop


The workshop is designed to help you anticipate possible questions, review what you've learned, and begin learning how to put your knowledge into practice.

Quiz

1.

What construct can you use to define an array?

2.

What function would you use to join two arrays?

3.

How would you declare a class called emptyClass that has no methods or properties?

4.

How would you choose a name for a constructor method?

Answers

1.

array()

2.

array_merge()

3.

Use the class keyword:

 class emptyClass { } 

4.

You don'ta constructor is named for the class in which it resides.

Activities

  1. Create a multidimensional array of movies organized by genre. This should take the form of an associative array with genres as keys, such as Science Fiction, Action, Adventure, and so forth. Each of the array's elements should be an array containing movie names, such as Alien, Terminator 3, Star Wars, and so on. When your arrays are created, loop through them, printing the name of each genre and its associated movie(s).

  2. Create a class called baseCalc() that stores two numbers as properties. Next, create a calculate() method that prints the numbers to the browser. Finally, create classes called addCalc(), subCalc(), mulCalc(), and divCalc() that inherit functionality from baseCalc() but override the calculate() method and print appropriate totals to the browser.



Sams Teach Yourself PHP MySQL and Apache All in One
Sams Teach Yourself PHP, MySQL and Apache All in One (4th Edition)
ISBN: 067232976X
EAN: 2147483647
Year: 2003
Pages: 333
Authors: Julie Meloni

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net