Skip to content

Instantly share code, notes, and snippets.

@fabeat
Created December 7, 2010 17:13
Show Gist options
  • Save fabeat/732078 to your computer and use it in GitHub Desktop.
Save fabeat/732078 to your computer and use it in GitHub Desktop.
<?php
$arr = array('foo ', ' bar ');
$arr = array_map(function($el){ return trim($el); }, $arr);
var_dump($arr);
array(2) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment