Trying to do a loop with a counter. It is necessary to make a schedule of the number of bans on the time of unix, I decided to do this:

while ($result = mysqli_fetch_assoc($query_sb)) { $data[] = date('d', $result['created']); } for($i = 0; $i < 1000; $i++) { if($data[$i] == NULL) {break;} $cnm = $i -1; if($data[$i] == $data[$cnm]) { $cntbans[$i][$b++]; } else { $b = 1; $cntbans[] = $data[$i]; } } print_r($cntbans['14']); 

But how can I derive the second array "number of bans" from $ cntbans ['Day'] ['number of bans']

PS Days are already recorded in the form 16,16,16,16,17,17,18,18,19,19 ...

    1 answer 1

    They say the truth: it's faster to decide how to explain to someone))) I will leave the code, it will suddenly come in handy to someone

      while ($result = mysqli_fetch_assoc($query_sb)) { $data[] = date('d', $result['created']); } for($i = 0; $i < 1000; $i++) { $cnm = $i -1; if($data[$i] == $data[$cnm]) { $b++; } else { echo $b. " "; echo $data[$cnm]; echo "<br>"; $b = 1; } if($data[$i] == NULL) {break;} }