3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
32.65 ms | 402 KiB | 5 Q