I tried to use array_walk_recursivefor something and wanted to use one of the class methods as a callback, so try:
array_walk_recursive($TAINTED, "$this->encode()");
and their variations failed. In the end, I decided:
array_walk_recursive($TAINTED, 'className::encode');
which works, but I read here that methods of calling a class in a static style like this are often considered bad practice. Or is this one of those situations where it is necessary?
So, is this the right thing to do, or is there a way to enable the callback function without having to use it as a method of a static class?
source
share