Create Class instance : Class Instance : Class PHP Source Code


PHP Source Code » Class » Class Instance »

 

Create Class instance



<?php
class ClassName{
   var $var1;
   var $var2;
  
   function myfunction1(){
      $result = "$this->var1 and $this->var2";
      return $result;
   }
  
   function myfunction2(){
      $myfunction1 = $this->myfunction1();
      return $myfunction1;
   }
}

$myclass = &new ClassName;

$myclass->var1 = "A";
$myclass->var2 = "B";

echo $myclass->myfunction1()."<br />";
echo $myclass->myfunction2()."<br />";
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Class
» Class Instance