- var_dump: documentation ( source)
<?php
$array =[203,204,204,203,203,205];
$i=-1;
$prev = null;
$new=[];
Foreach($array as $val){
If($val != $prev){
$i++;
}
if(!isset($new[$i][$val])){
$new[$i][$val] =1;
}else{
$new[$i][$val]++;
}
$prev = $val;
}
var_dump($new);