R
R
Rockman2015-02-06 22:33:48
PHP
Rockman, 2015-02-06 22:33:48

Is it possible to call a method every time any static method is called?

Whether prompt it is possible to cause a certain method at each call of any static method of a class? So that each static method does not call the same method, but that it is called itself every time the static methods of the class are called.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Yakhnenko, 2015-02-07
@ayahnenko

I agree with com. Gorgeous, the idea is crappy, most likely you have something wrong with the design.
If you need to do something before something, it is better to use a wrapper class.

I
IllusionTurtle, 2015-02-06
@IllusionTurtle

php.net/manual/ru/language.oop5.overloading.php#ob...
__callStatic - will be called every time when you call any static method in this class, respectively, then you do what you need and redirect execution to the method that was called.

I
IceJOKER, 2015-02-06
@IceJOKER

create a class with the __callStatic() method, call the method you need there, and call the methods something like this
if the method is called myStaticMethod() , then call myStaticUnknownMethod() (well, something different from the real method) and in __callStatic() already call the desired method.
mega-velik ))
alas, the first thing that came to mind: D forgive me...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question