array_walk() function problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PatelNehal
Forum Newbie
Posts: 21
Joined: Mon Mar 23, 2009 7:27 am
Location: Gujarat, India

array_walk() function problem

Post 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
Post Reply