3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array("Item1.10", "Item2.5", "Item3.0", "Item2.2", "Item4.50", "Item2.50"); $tempArray = array(); $newArray = array(); foreach($array as $value) { $item = explode(".", $value); if(!in_array($item[0], $tempArray)) { $newArray[] = $value; $tempArray[] = $item; } } print_r($newArray);
based on uITU2
Output for 4.3.0 - 7.1.0
Array ( [0] => Item1.10 [1] => Item2.5 [2] => Item3.0 [3] => Item2.2 [4] => Item4.50 [5] => Item2.50 )