I have a class, let's say "A" and an attribute private $subModules=Array('func1', 'func2'), where func1 and func2 are the names of private methods in class A.
Class A also have a function public, run() where I try to run methods from attribute $subModules:
class A extends B {
private $subMethods = Array('func1', 'func2');
private function func1($a) { // do something }
private function func2($a) { // do something else}
public function run() {
foreach ($this->subMethods as $fnc) {
call_user_func(array($this, $fnc));
}
}
Can you tell me what it is wrong with this? I try to do something like this:
$this->func1('5');
The error message it is this:
Argument 1 passed to A::func2() must be an instance of B, none given
Thank you!