Object Initialization : Objects « Class « PHP






Object Initialization

 
<?php
class foo {
    function do_foo() {
        echo "Doing foo.";
    }
}
$bar = new foo;
$bar->do_foo();
?>
  
  








Related examples in the same category

1.Comparing Objects with == and ===
2.Create a new class and create an instance then use its property and method
3.Object Overloading
4.Object Properties
5.Object Type Information
6.Objects Within Objects
7.Creating a new object and assigning it to a variable