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) { list($item, ) = explode(".", $value); if(!in_array($item, $tempArray)) { $newArray[] = $value; $tempArray[] = $item; } } print_r($newArray); ?>
based on qPAlK
Output for 4.3.0 - 7.1.0
Array ( [0] => Item1.10 [1] => Item2.5 [2] => Item3.0 [3] => Item4.50 )