Re: singleton in php?

[email protected] ("robert janeczek") Wed, 4 Sep 2002 22:58:18 +0200
Newsgroups php.lang
Message-ID <[email protected]>
> i want it so i only ever have one object of this class ever in my program.
> all new instances of the object will simple be references to the first
> object.
>
> how can i implement this? i can do it in java by making the constructor
> private and then having a static method to return a static variable init
to
> an object of the class if it is not init yet.
>
> how can i have a singleton object in php?
> ASAP via email as well. cheers

you should look at some pear classes code. for example - log class provides
method to create single instances.

rashid