Basically the purpose of the static keyword is totally clear to me, the PHP docs only explain the purpose of the keyword in the context of classes. I noticed one of my IDE plugins suggesting me that I should declare many of my callback functions as static. Without static: With static: For the result it does not make a difference,
Tag: static
Getting properites of static class in static function?
I just wanna get return class properties in not instantiated class use. There is no way to instance this class? Please tell me…! My example is below↓↓
Numeration of documents on PHP
PHP, Laravel 6.0: I can’t write a working static function or a variable for getting numeration of my documents with increment. Every time I create a document it should set its number (Document #1, #2, …
Where to put arrays with constant value that will be accessed many times?
I have some arrays storing the possible parameters for some 3D printer commands. I use this to check if the command is legal. I am confused about where I should put these arrays. These arrays will only be accessed in the formatcheck function, and the function will be called many times as there are thousands of commands to check. Should
Static class initializer in PHP
I have an helper class with some static functions. All the functions in the class require a ‘heavy’ initialization function to run once (as if it were a constructor). Is there a good practice for achieving this? The only thing I thought of was calling an init function, and breaking its flow if it has already run once (using a