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 >= $time) { $countPerDay++; } else { $from += 86400; array_push($days, $countPerDay); if ($countPerDay != 0) { $countPerDay = 0; } } } var_dump($days);
based on g0M6G
Output for 4.3.0 - 7.2.0
array(2) { [0]=> int(2) [1]=> int(0) }