Objects

Object Initialization

To initialize an object, you use the new statement to instantiate the object to a variable.

  1 
  2 class foo {
  3     function do_foo () { 
  4         echo "Doing foo."; 
  5     }
  6 }
  7 
  8 $bar = new foo;
  9 $bar->do_foo();
 10