如果我在类函数中使用array_walk来调用同一个类的另一个函数
class user
{
public function getUserFields($userIdsArray,$fieldsArray)
{
if((isNonEmptyArray($userIdsArray)) && (isNonEmptyArray($fieldsArray)))
{
array_walk($fieldsArray, 'test_print');
}
}
private function test_print($item, $key)
{
//replace the $item if it matches something
}
}
它给我以下错误 –
Warning: array_walk() [function.array-walk]: Unable to call
test_print() – function does not exist in …
那么,如何在使用array_walk()时指定$ this-> test_print()?