Reputation:
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.
Upvotes: 0
Views: 235
Reputation: 539
<?php
$a=array("a"=>"red","b"=>"green","c"=>"red");
print_r(array_unique($a));
?>
Upvotes: 0
Reputation: 691
<?php
$original = array("red", "red", "blue");
$unique = array_unique($original);
print_r($original);
print_r($unique);
?>
Upvotes: 1