You must create a new object inside the static method to access not-static methods inside that class:
Reference: https://stackoverflow.com/questions/41631623/how-to-call-non-static-method-from-static-method-of-same-class
class Foo {
public function fun1() {
echo 'non-static';
}
public static function fun2() {
echo (new self)->fun1();
}
}
Reference: https://stackoverflow.com/questions/41631623/how-to-call-non-static-method-from-static-method-of-same-class
Comments
Post a Comment