Page 1 of 1

array_walk() function problem

Posted: Sat Jun 06, 2009 4:58 am
by PatelNehal
I had created a class and function to trim the value in array

Code: Select all

 
Class DemoClass
{
 var $myarray;
function DemoClass()
{
   $this->myarray = array(" xyz ", "   abc","879..   ");
}
function trim_value(&$value) 
    { 
        $value = trim($value); 
    }
function getArray()
{
   array_walk($this->myarray, 'trim_value');
}
}
 
now when i run the code it is giving me error :

Warning: array_walk() [function.array-walk]: Unable to call trim_value() - function does not exist