Answer the question
In order to leave comments, you need to log in
Why use private static in PHP methods?
Good afternoon!
As far as I understand, the static methods of a class allow themselves to be used without creating an instance of this class. Those. in fact, we can use these methods just like ordinary "functions".
Something like: MyClass::stati_method()
But often I see that private static methods are used. Why make them private, because then the above example will not work. Help me understand this nuance
Answer the question
In order to leave comments, you need to log in
Most often, I observe this behavior in the implementation of the singleton pattern https://refactoring.guru/ru/design-patterns/single...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question