Re: singleton in php?
- Date: Wed, 5 Sep 2018 12:26:18 +0200
- From: "Christoph M. Becker" <cmbecker69@xxxxxx>
- Subject: Re: singleton in php?
On 02.09.2018 at 22:15, Jeffry Killen wrote:
> I have been trying to get a better understanding of "singleton".
> It is defined as a class that can only produce one instance of
> In the online explanation, that is accomplished by a
> private constructor function that produces an instance
> of the class within its instance.
> But in php I am of the understanding that a constructor
> function has to be made public and can't return anything.
> Here is the online reference I am looking at:
> So, at some point it seems that the class instance has to
> be exported via a return statement at some point, otherwise
> how would it be used in other code?
> Is there a part of the manual that addresses this?
There has been a manual page about OOP design patterns, but it has
been removed from the PHP manual (IMO, rightly so, since this is out of
scope). Nonetheless, the part about singletons might still be worth
Christoph M. Becker