如何在父类中访问相同的名称方法?

Here is a simplified of my code:

class questions {

    public function index( $one = '', $two = '', $three = '' ) {
        return 'sth';
    }
}


class tags extends questions {

    public function index () {
        return parentClass::index();
    }

}

But my code throws this error:

enter image description here

Does anybody know how can I fix the error?

expected result is printing: sth

If you extend a class and override a method, you must make sure the overridden method has the same "prototype", i.e., it must have the same number of method arguments in the same order. That's why you get the first warning:

Warning: Declaration of tags::index() should be compatible with questions::index($query_where = '', $query_join = '', $called_from = NULL) in C:\xampp\htdocs\myweb\others\tags.php on line 3

Second, if you want to call a function with the same name from the parent class, you'll need to use the parent keyword:

class tags extends questions {

    public function index ($query_where = '', $query_join = '', $called_from = NULL) {
        return parent::index($query_where, $query_join, $called_from);
    }

}