Re: Re: new overloading feature?
| From: | Lukas Smith | Date: | Tue, 10 May 2005 15:49:26 +0000 |
| Subject: | Re: Re: new overloading feature? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-16203@lists.php.net to get a copy of this message | ||
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