<?php

$numbers = array(1, 15, 7, 3, 8, 8, 19, 5, 12, 8, 2, 6, 8);
// $numbers = array(1, 15, 8, 8, 8, 8, 7, 3, 19, 5, 12, 2, 6);

$counter = 1;
$index = 0;
if (count($numbers) > 0) { 
    $prev = $numbers[$index++];
}

while ($index < count($numbers) && $counter < 4) {
    $next = $numbers[$index++];
    if ($prev == $next) { 
        $counter++;
    }
    else {
        $counter = 1;
        $prev = $next;
    }
}

if ($counter == 4) { 
    print("Found four times repeated number");
}
else { 
    print("No four times repeated number found");
}