Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16203 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8447 invoked by uid 1010); 10 May 2005 15:57:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75588 invoked from network); 10 May 2005 15:49:28 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 10 May 2005 15:49:28 -0000 X-Host-Fingerprint: 212.112.227.169 ipx11223.ipxserver.de Linux 2.4/2.6 Received: from ([212.112.227.169:36698] helo=ipx11223.ipxserver.de) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id 1E/48-35155-808D0824 for ; Tue, 10 May 2005 11:49:28 -0400 Received: from localhost (localhost [127.0.0.1]) by ipx11223.ipxserver.de (Postfix) with ESMTP id 96CF3DF017F; Tue, 10 May 2005 17:49:54 +0200 (CEST) Received: from ipx11223.ipxserver.de ([127.0.0.1]) by localhost (ipx11223 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31015-07; Tue, 10 May 2005 17:49:51 +0200 (CEST) Received: from [192.168.0.101] (user-0cal1oq.cable.mindspring.com [24.170.135.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ipx11223.ipxserver.de (Postfix) with ESMTP id 3B94BDF0121; Tue, 10 May 2005 17:49:51 +0200 (CEST) Message-ID: <4280D806.4040108@php.net> Date: Tue, 10 May 2005 11:49:26 -0400 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: =?UTF-8?B?T25kcmVqIEl2YW5pxI0=?= Cc: internals@lists.php.net References: <4qdcz84j.fsf@random.internal> <427FA67E.2020506@omniti.com> <427FC9D1.1030607@php.net> <4280AFD4.9080306@php.net> <4280CB8B.4050101@kmit.sk> In-Reply-To: <4280CB8B.4050101@kmit.sk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by somedaemon at backendmedia.com Subject: Re: [PHP-DEV] Re: new overloading feature? From: lsmith@php.net (Lukas Smith) 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