Instantiate class by calling the constructor : Constructor : Class PHP Source Code


PHP Source Code » Class » Constructor »

 

Instantiate class by calling the constructor




<?php
   class Staff
   {
      private $ein;
      function __construct($ein)
      {
         if ($this->verify_ein($ein)) {
            echo "called";
         }
      }
   
      protected function verify_ein($ein)
      {
         return TRUE;
      }
   }

   $employee = new Staff("123");

?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Class
» Constructor