Using Correct Callback Method Scope Within a PHP Class

If your calling method in a class has a callback function as a parameter such as usort() or array_walk() you need to call the callback function in the correct scope or php will not find it.

If your using array_walk() within a class method then you need to define the callback this way.

class SomeClass {

function doIt() {

function someFunc() {



$this refers to the container SomeClass class.

If someFunc() is a static function in the class then do this way.


Leave a comment