Wednesday, January 9, 2013

Creating a Class

In this articles,we will know how to instantiate an object .


Save in a file called class.Demo.php
<?php
  class Demo{
 }
?>


Save in a file called testDemo.php
<?php
     require_once("class.Demo.php");
     /* in this case,we use "require_once",it is because this file is a libraries.we 
      should use"Include_once" for displaying Templates.
      */
    $objDemo=new Demo();
     //we instantiate an object "objDemo" which will point to a class "Demo"   
?>





No comments:

Post a Comment