使用PHP识别重复模式

I need to find the number of records that are greater than a specific float and find the group of data that repeat the most. For example, I have the data below and I need to find how many entries have values > 4.

 1.5
  1.7
    4.5
    4.7
    4.8
    1.4
    4.5
    4.9

In the above data the longest continuous repetition of values greater than 4 is 4.5,4.7,4.8. Therefore the total I would like returned should be 3. As you can see the pattern breaks after 4.8 since the number is 1.4 above. Is there a way to identify this pattern?

Try this, I have used here an array:

$arr = array(
        0 => '1.5',
        1 => '1.7',
        2 => '4.5',
        3 => '4.7',
        4 => '4.8',
        5 => '1.4',
        6 => '4.5',
        7 => '4.9'
      );
      $chk_val = 4; // value which is checking
      $cnt = 0;$inc = 0;
      foreach ($arr as $i => $val) {
        if ($val > $chk_val) {
          $inc++;
          if ($inc > $cnt) { $cnt = $inc;}
        } else {
          $inc = 0;
        }
      }
      echo $cnt;

try this

$n = 4; // number to check
$count = 0;
$max = 0;
$ele = array(1.5, 1.7, 4.5, 4.7, 4.8, 1.4, 4.5, 4.9);
for ($i = 0; $i < count($ele); $i++) {
  if ($ele[$i] >= $n) {  // check for greater element than given number
    $count++;    // increase consecutive counter variable 
    $arr[$max] = $count; //save continues max counter to array
  } else {
    $count = 0; //reset consecutive counter 
    $max++;
  }    
}
echo max($arr);

Quick and dirty...

function findNums($nums, $min = 4) {
  $groups = array();
  $groupcounts = array();
  $groupindex = 0;
  foreach($nums as $num) {
    if($num > $min) {
      $groups[$groupindex][] = $num;
      if(array_key_exists($groupindex, $groupcounts)) {
        $groupcounts[$groupindex]++;
      } else {
        $groupcounts[$groupindex] = 1;
      }
    } else {
      $groupindex++;
    }
  }
  return array($groupcounts, $groups);
}

// $your_numbers is your list
$nums = array_map('trim', explode("
", $your_numbers));
$result = findNums($nums);
$counts = $result[0];
$maxcount = max($counts);
$groups = $result[1];
echo "max count is ".$maxcount." with values:
";
$key = array_search($maxcount, $counts);
var_dump($groups[$key]);