All,

I want to build a config file class that gets called statically. Is there such a thing as a static constructor? Example:

class Daz_Config {
  public static function load() {
    ...
  }
  public static function get($key) {
    self :: load();
    ...
  }
}

Daz_Config :: get('myvalue');

I want to call the load function when the class is used for the first time. If no code ever calls "Daz_Config :: get(...)" then I never want to invoke load() but if it does get called, I only want to call load() once before the class is used further.

Anyone know how to do this with calling load() at the top of all the other functions and writing a load() function that exits early if already loaded?

-- Dante

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to