On Nov 22, 2007 11:52 AM, Robert Cummings <[EMAIL PROTECTED]> 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

Reply via email to