Ondrej IvaniÄ wrote:
class SingletonFactory { private $instances;
__construct() { $this->instances = array(); }
function getInstance($name) { if(is_a($this->instances[$name], $name) === false) { $this->instances[$name] = new $name; } return $this->instances[$name]; } }
FYI: SingletonFactory can be a pure static class.
yes it just doesnt work if you normally already use a factory ..because then you cant do $name::factory();
regards, Lukas
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php