How do I use parameters of parent class method with the same method name?

codeigniter, php

Solution

function some_function($a, $b, $c) {
    call_user_func_array('parent::some_function', func_get_args());
}

WARNING: PHP >= 5.3

or even:

function some_function($a, $b, $c) {
    call_user_func_array('parent::' . __FUNCTION__, func_get_args());
}

Problem

The title is a bit confusing, I know, but it's the best I could do. =P Hopefully, someone will be able to help. I'm using CodeIgniter and I have a method in a base class that has multiple parameters: ``` class MY_Base extends CI_Model { function some_function($param1, $param2 ... $param8) { // do stuff } } ``` What I want to do is basically this, in a child class: ``` class Child extends MY_Base { function some_function($param1, $param2 ... $param8) { parent::some_function($param1, $param2 ... $param8); // call a methods found in this class only $this->some_method(); } function some_method() { // do more stuff } } ``` I can't touch the base classes so I have to extend from it. Problem is, There are just too many parameters. And this happens in different methods as well and sometimes I forget one which makes the code fail. So I was wondering, if there's a way to write it like this: ``` function some_function(__PARAMETERS__) { parent::some_function(__PARAMETERS__) } ``` I seem to vaguely recall that this is possible but I can't find it in Google. Probably because I'm searching the wrong keywords. Any help would be appreciated. EDIT: And then, of course, I find `func_get_args()` after posting this question. This seems to do what I want, but I'll leave this question up for better ideas.

Original source