bian goole bian goole - 5 months ago 38
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";

$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
$original = array("red", "red", "blue");
$unique = array_unique($original);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download