Trimming array elements in PHP
Several times I’ve had a user setting that was separated by commas that I needed to split out into an array. People, correctly, put a space after commas. But for the array the space shouldn’t be there. Here’s a quick tip to strip out those leading spaces.
PLAIN TEXT
PHP:
$array = array_map(‘trim’, $array);
array_map [...]