3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $statuses = ['DELIVERED ', ' COLLECTED']; var_dump($statuses); array_walk($statuses, create_function('&$val', '$val = trim($val);')); var_dump($statuses);
based on 77Tai
Output for 7.2.0
array(2) { [0]=> string(10) "DELIVERED " [1]=> string(10) " COLLECTED" } Deprecated: Function create_function() is deprecated in /in/BTXa3 on line 7 array(2) { [0]=> string(9) "DELIVERED" [1]=> string(9) "COLLECTED" }
Output for 5.4.9 - 7.1.10
array(2) { [0]=> string(10) "DELIVERED " [1]=> string(10) " COLLECTED" } array(2) { [0]=> string(9) "DELIVERED" [1]=> string(9) "COLLECTED" }
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/BTXa3 on line 3
Process exited with code 255.