3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $from = time(); $times = array($from, $from+86400, $from+86400+86400+86400, $from+86400+86400+86400+86400+86400+86400); $days = array(); $countPerDay = 0; foreach ($times as $time) { if ($from + 86400 - 1 > $time) { $countPerDay++; } else { $from += 86400; array_push($days, $countPerDay); if ($countPerDay != 0) { $countPerDay = 0; } } } var_dump($days);
based on BoO9o
Output for 4.3.0 - 7.2.0
array(3) { [0]=> int(1) [1]=> int(0) [2]=> int(0) }