PHP: Calling a function whenever a function in a child class is called

Viewed 686

Within a single class, I am able to use the _call/_callStatic functions to call a function before any function is actually run. However, I'm yet to find a solution that I can apply to the parent, and it will be inherited by the children.

The only method I can think of is putting a small snippet of code within each class that calls a function in the parent, which contains my code.

Are there any better solutions that I can implement?

3 Answers
Related