3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function getVehicleType($id, $types) { $types = explode(';', $types); foreach ($types as $type) { $type = substr($type, 0, 1); } echo print_r($types); } getVehicleType(1, '1 - teste;2 - teste;3 - teste;'); ?>
based on fNmKZ
Output for 4.3.0 - 7.2.0
Array ( [0] => 1 - teste [1] => 2 - teste [2] => 3 - teste [3] => ) 1