This is a handy reference for trimming values in an associative array. While there's any number of ways to achieve the result, this works nicely.
A multidimensional array is immune to the above code. The following function will work on a string or array.
1
<?php
2
/*
3
Trim Values in an Array or Multidimensional Array
4
http://www.beliefmedia.com/code/php-snippets/trim-array-values
5
*/
6
7
function beliefmedia_trim($data) {
8
if ($data == null) return null;
9
10
11
12
13
}
Got an easier way? Let us know.