Referrring to a class object's internal/own function via string referral

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to make use of array_walk_recursive, inside a function definition, inside a class definition, to apply another of the class' internal functions recursively to every member of an array class property, and one of the parameters it requires is the string name of the function to implement in it's usage:
bool array_walk_recursive ( array &$input , callable $funcname [, mixed $userdata = NULL ] )

However, this works fine if I am referring to making use of a sort of global, externally defined function, but, since you literally pass it the name of the function to make use of in a string value, how would I thus refer to a function defined inside the class definition?

This is, since, something along the lines of the following three examples both don't work for varying/different reasons:
array_walk_recursive($arToPass, "$this->functionName", $extraParameter);
array_walk_recursive($artoPass, '$this->funcName', $extraParameter);
array_walk_recursive($artoPass, "funcName", $extraParameter);

Also tried assigning another variable the value of the function before then trying to pass it through, but that also doesn't work:
$fn = $this->funcName;
array_walk_recursive($arToPass, $fn, $extraParameter);

Thus, what am wondering is if you need to pass a reference to a function through to another process/function/method, using the string value of it's name, etc., how would you then refer to something like the parent class' internally defined function as such?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux