Re: is there a static constructor?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



class Daz_Config {
   private static $instance;

   private function __construct(){
      $this->load();
   }

   private function load() {
      ...
   }

   public function get($key) {
      ...
   }

   public static getInstance(){
      if (!self::$instance) self::$instance = new Daz_Config();
      return self::$instance;
   }
}

Then you can do:
Daz_Config::getInstance()->get('myvalue');

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux