Magic functions and inheritance

I would like to know if it is possible to create a magic object that extends another magic object (with PHP).

+3
source share
1 answer

I'm not quite sure what you are asking ... do you want to explicitly call the magic methods of the parent class? If so, you can use the class reference parent:

class Object extends dbObj{
    // ...
    // this is what i'm assuming you're looking for:
    public function __call($method, $variables){
        return parent::__call($method, $variables);
    }
}
+6
source

Source: https://habr.com/ru/post/1718600/


All Articles