I have a class with one non-static method function Tire(){}
like this
class Car{
function Tire(){}
static function __callStatic($func, $arg){
if(method_exists(__CLASS__, $func)){
return self::$func();
}
}
}
I am trying to call it statically as
Car::Tire()
But, I get this error.
Strict Standards: Non-static method Car::Tire() should not be called statically
Writing return self::$func();
actually runs the $func
statically and returns it result. You can't run a non-static function statically — thus, the error message.
You can not call a non-static function from a static context. Static context doesn't have any object to operate with. If you would even be able to call that non-static function, how would it operate if the object does not exist?