$state = null;
$repeats = 0;
array_push($array, null);
foreach($array as $value) {
if ($value != $state) {
if ($repeats > 0) {
echo "Повтор $state - $repeats раз\n";
}
$state = $value;
$repeats = 0;
} else {
$repeats++;
}
}