3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(-1); ini_set('display_errors', 'On'); /** * @param DateTimeImmutable $start * @param DateTimeImmutable $end * * @return Generator */ function remainingDaysPerMonthBetween(\DateTimeImmutable $start, \DateTimeImmutable $end): \Generator { while ($start < $end) { $diff = $start->diff(min( $start->modify('last day of this month'), $end )); yield [$start, $diff->days]; $start = $start->modify('first day of next month'); } } $start = new \DateTimeImmutable('2019-02-11'); $end = new \DateTimeImmutable('2019-04-23'); foreach (remainingDaysPerMonthBetween($start, $end) as [$date, $remainingDays]) { printf("%s: %d\n", $date->format('M'), $remainingDays + 1); }
Output for git.master, git.master_jit, rfc.property-hooks
Feb: 18 Mar: 31 Apr: 23

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.85 ms | 401 KiB | 8 Q