My problem is this, i have a function which is stored in an array which is a part of a class. I want to call a function from this array using call_user_func() however i can’t seem to figure out how to write this.
Calling a function from an array which is not in a class can be done like such.
$thearray = array( 0 => 'funcone', 1 => 'functwo');
call_user_func($thearray[0]);
However when i try to do this to an array which is in a class, it do sent work, i imagine because i need to reference the class somehow. I know that you can call a function from a class like this:
call_user_func(array($myclass, 'funcone'));
But my question is how would a call a function from an array, which is within a class, by using call_user_func(); i hope somebody can help me with this, i have a feeling that it is just a matter of how its written.
Assuming the array within the class is public, you can do:
Did that answer your question?
Update:
I tried the following and it worked: