I understand how late static binding works, but I can’t seem to come up with a time when I’d use it. The examples on the PHP site are nice, but don’t show any kind of realistic usage. I’m just wondering if there are any examples of when LSB is absolutely necessary to solve a problem, or when it helps simplify potentially complicated code.
Share
It can be used to create static factory patterns, using late static binding with static method overloading to prevent requiring additional cumbersome factory classes, such as:
if you like that sort of thing, of course.