3v4l.org

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