bian goole bian goole - 27 days ago 8
PHP Question

How to show only the non duplicated values of an array

I have an array and i want to show all values but dont wanna show the double values. I dont want to delete the double values with the array_unique() function. Can someone show me how to do it.

foreach ($comTemperatures1 as $value) {
//$y = "0";

//$y++;
$class = "TC " . $value;
//if ($thermoStatus[$y] == '0' ) {
echo"<td class=\"$class\" id=\"$class\">" . $temperatures[$value] . "</td>";
//} else if ($thermoStatus[$y] == '6' ) {
//}
}

$comTemperatures1 = array('3' ,'3','4', '4');


It't not a duplicate question because i don't want to delete the values.

Answer Source
<?php
$original = array("red", "red", "blue");
$unique = array_unique($original);
print_r($original);
print_r($unique);
?>