How can I invoke a function automatically when any static function is called once.
class A{
private static $val;
public static function X(){
return static::$val;
}
}
class B extend A
{
}
Is it possible if I call B::X();
then a function can set the value of $val
of parent class. This has to be done without creating a instance of class B
.
I wanted to do this automatically. something like what construct does. Before any static method is called I want to invoke a function automatically