$myArray = array(2, 7, 4, 2, 5, 7, 6, 7);
$uniques = array_unique($myArray);
除了仅在数组中显示每个值一次外,我还将如何显示(在下面的 foreach 循环中)每个值在数组中填充的次数。IE旁边'7'(数组值),我需要显示'3'(7在数组中的次数)
foreach ($uniques as $values) {
echo $values . " " /* need to display number of instances of this value right here */ ;
}