PHP: Singleton vs Static Class

Possible duplicate:
Difference between static class and singleton pattern?

I just wanted to know what exactly is the difference between singleton and static classes?

+7
oop php static-methods singleton
source share
5 answers

I think this question has already been answered: The difference between a static class and a singleton pattern?

+5
source share

In singleton, you can choose to initialize the variable on the first call. While the static variable begins to exist at the moment when you include / call the file in which the static variable is declared.

+3
source share

Singleton is a template that has nothing to do with a particular language implementation. Technically, singleton says that you can only have one instance of an object in the system. In the case of a static class, you will not have any objects at all.

+1
source share

The big difference between singleton and empty static methods is that singletones can implement interfaces . But static font

Difference between static class and singleton pattern?

+1
source share

Syntax is an abstract design template that describes an object that can only be created once. A static class is a concrete implementation of this design pattern.

+1
source share

All Articles