Web Applications

Lab 06

Agenda

  • PHP language and OOP

PHP CLI

  • Additional (maintenance) commands for your web applicatio
  • Periodic scripts (executed by CRON)
  • ...
  • Our reason: It is simpler to test your knowledge of the language using CLI.
  • Online PHP Interpreter

Exercise 1

ShoppingCart

ShoppingCart

Download php file and add code so the file can be executed and produce the desired output.

The objective is to implement a simple class for a shopping cart.

Exercise 2

Arrays and iterators

Arrays and iterators

Download php file and add code so the file can be executed and produce the desired output.

The objective is to allow users of the ShoppingCart class, to access the content in an array-like fashion. The next objective is to allow for foreach iteration.

Exercise 3

Factory

Factory

Download php file and add code so the file can be executed and produce the desired output.

The objective is to provide a user of the ShoppingCart class with the ability to save the class content into JSON and string. We would also like to make it easily extensible in the future.

Exercise 4

Proxy

Proxy

Download php file and add code so the file can be executed and produce the desired output.

The objective is to monitor how many times has been a given function called.

The end…

Questions?

Feedback