3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 0 => ' abc', 1 => ' def', 2 => 'ghi ' ); var_dump($a); $b = array_map('trim', $a); var_dump($b);
based on UupOZ
Output for 4.3.0 - 7.1.0
array(3) { [0]=> string(4) " abc" [1]=> string(4) " def" [2]=> string(5) "ghi " } array(3) { [0]=> string(3) "abc" [1]=> string(3) "def" [2]=> string(3) "ghi" }