title: How do I use a class method as a callback function?
body: <p>If I use <code>array_walk</code> inside a class function to call another function of the same class</p>
  
  <pre><code>class user
  {
     public function getUserFields($userIdsArray,$fieldsArray)
     {
  
       if((isNonEmptyArray($userIdsArray)) &amp;&amp; (isNonEmptyArray($fieldsArray)))
       {
           array_walk($fieldsArray, 'test_print');
       }
     }
  
  
    private function test_print($item, $key)
    {
           //replace the $item if it matches something
    }
  
  }
  </code></pre>
  
  <p>It gives me the following error - </p>
  
  <blockquote>
    <p>Warning:  <code>array_walk()</code> [function.array-walk]: Unable to call 
    <code>test_print()</code> - function does not exist in ...</p>
  </blockquote>
  
  <p>So, how do I specify <code>$this-&gt;test_print()</code> while using <code>array_walk()</code>?</p>