Answer the question
In order to leave comments, you need to log in
Why static methods in a class (PHP)?
Hello everyone) I immediately apologize for the probably stupid question, but still, can someone explain the thread when and when to declare static methods?
At once questions:
1. If you declare static that it is possible to address without creation of object Class:: statikFunk;
What does it give me?
Less load?
Just a convenience?
2. When to declare statics?
What is their juice so to speak? What problems are being solved.
I have already apologized for the stupidity of the question, please understand and forgive, and explain in a nutshell)))
Answer the question
In order to leave comments, you need to log in
can be accessed without creating a Class::statikFunk object
They are mainly used by helpers, such as a mini library for processing and / or receiving data,
for example, classes for working with strings, arrays, files, etc.,
To host related logic that needs to be available without creating an instance of the class.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question