3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = array( 'azfihj ', ' rg grpge', ' pgkk ' ); foreach ($foo as $key => $bar) { $foo[$key] = trim($bar); } var_dump(array_map('trim', $foo));
based on Zcact
Output for 5.6.0 - 5.6.30, hhvm-3.18.4 - 3.21.0, 7.0.0 - 7.3.0rc3
array(3) { [0]=> string(6) "azfihj" [1]=> string(11) "rg grpge" [2]=> string(4) "pgkk" }