How To Trim Whitespace From Exploded Elements In PHP

Author: , May 7th, 2012

Here is a one-liner that explodes a string and trims whitespace from each element: $array = array_map(‘trim’,explode(‘,’,$str));