Recently I needed to call trim() for multiple variables in an array in my CodeIgniter application, but had issues with calling the custom function using array_walk() to do so. A bit of Googling and experimentation led me to this answer:
// trim array data
array_walk($data, array($this, ‘trim_value’));
$value = trim($value);
You have to pass array_walk() or array_walk_recursive() an array with $this as a defined variable/pointer.
Try that piece of code if you’re having an issue!