Re: Code Critique Please :)

From: Date: Mon, 26 Nov 2007 15:00:48 +0000
Subject: Re: Code Critique Please :)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-265027@lists.php.net to get a copy of this message
On Nov 22, 2007 11:52 AM, Robert Cummings <robert@interjinn.com> wrote: > On Thu, 2007-11-22 at 12:46 -0500, Oscar Gosdinski wrote: > > > > There is something that i always wonder about Singleton pattern in > > PHP, do you really have a benefit using this pattern in PHP? The idea > > behind this pattern is that only one instance of the class is created, > > it works great in Java because all requests are processed inside a JVM > > and this instance created will really be the only one defined. Because > > in PHP every request has its own environment, you will have several > > instances of this class per request processed. > > Doesn't matter... you may have multiple requests for the object within > the same HTTP request. Singleton pattern is very valid in PHP. > > Cheers, > Rob I don't know if I should be embarrassed or not, but I'd not heard of the Singleton pattern before. So, I enlightened myself and learned something new (and it's only 9:00 am on a Monday morning!). =D Google it or click here - it's pretty easy reading... http://en.wikibooks.org/wiki/Computer_Science/Design_Patterns ~Philip

« previous php.general (#265027) next »