3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 0 => array( 0 => ' abc', 1 => ' def', 2 => 'ghi ' ) ); var_dump($a); array_walk($a, 'trim'); var_dump($a);
based on vVfvr
Output for 5.3.0 - 7.1.0
array(1) { [0]=> array(3) { [0]=> string(4) " abc" [1]=> string(4) " def" [2]=> string(5) "ghi " } } Warning: trim() expects parameter 1 to be string, array given in /in/846Ji on line 14 array(1) { [0]=> array(3) { [0]=> string(4) " abc" [1]=> string(4) " def" [2]=> string(5) "ghi " } }
Output for 4.3.0 - 5.2.17
array(1) { [0]=> array(3) { [0]=> string(4) " abc" [1]=> string(4) " def" [2]=> string(5) "ghi " } } Notice: Array to string conversion in /in/846Ji on line 14 array(1) { [0]=> array(3) { [0]=> string(4) " abc" [1]=> string(4) " def" [2]=> string(5) "ghi " } }