Possible Duplicate:
When to use static vs instantiated classes
I’m having a little trouble understanding the advantages/disadvantages of static vs “normal” classes in PHP, since it seems that I’m able to do the same thing with both.
If I’m able to have static variables in classes and get/modify them easily with static methods, why do I even need class instances?
The
Staticinstance of a class only happens once, and its variables are available to any instance of the class. Instances have their own individual values which are not accessible to other instances, except where they are markedstatic.Instances are useful when there will be more than one instance of the class.