NYCPHP Meetup

NYPHP.org

[nycphp-talk] How to create a singleton class in PHP

Dan Cech dcech at phpwerx.net
Thu Feb 12 16:48:03 EST 2004


No problem.

In PHP5 you could just implement it a little differently with 
$errorArray being a static class variable instead of a static variable 
inside the function.

However, if you wanted to be able to have classes inherit from the 
ActionHandler class and be able to call the functions as object methods 
on instances of those classes, or instances of the ActionHandler class, 
the implementation we ended up with is the only way to go.

Dan

Phil Powell wrote:
> Forcing the keys to be unique fixed the problem and no need to use 
> $GLOBALS.  But honestly, this will [probably] be easier in PHP5.
> 
> Thanx for your patience.
> 
> Phil




More information about the talk mailing list