For all those people trying to shoe-horn trim() into array_walk() and have found all these tricks to work around the issue with array_walk() passing 2 parameters to the callback...
Check out array_map().
http://php.net/array_map
It's all sorts of win.
For the record. I'm one of these people and after 15 years of php development I'm pleased to say that there's still things I'm learning. :) I just found out about array_map() myself...