Friday, 11 February 2011

Objects in PHP

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

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

No comments:

Post a Comment