- print_r: documentation ( source)
- explode: documentation ( source)
- in_array: documentation ( source)
<?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);
?>