Member-only story
PHP Late Static Binding Explained
Here’s an interesting topic that I learned about in a surprising way while coding.

Before we start, let’s clarify some terms:
- Late static binding (LSB) is the combination of late binding and static binding, two different concepts.
- Static, in a very short summary, refers to making static calls when you don’t need any object creation.
- Static binding (early binding) happens at compile time.
What is Static Binding?
Static binding refers to the process of resolving static method calls at compile-time. When a method is declared as static, it means that the method belongs to the class itself rather than an instance of the class.
Static binding is used when the method is called and is known at compile-time, based on the class from which the call is made. The decision of which method to call is made during the compilation phase, and the appropriate method is bound to the call.
What is PHP late static binding?
When a static method is called from a subclass that overrides the method, the static binding refers to the class where the method is called, rather than the class in which it is defined.