3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = (new DateTime('1 year ago'))->modify('first day of current month'); $end = (new DateTime())->modify('first day of current month'); $interval = new DateInterval('P1M'); $period = new DatePeriod($start, $interval, $end); $months = array(); foreach ($period as $dt) { $months[] = $dt->format('Y-m-d'); } $reverse_months = array_reverse($months); print_r($reverse_months);
Output for git.master, git.master_jit
Warning: DateTime::modify(): Failed to parse time string (first day of current month) at position 13 (c): The timezone could not be found in the database in /in/a1khU on line 2 Warning: DateTime::modify(): Failed to parse time string (first day of current month) at position 13 (c): The timezone could not be found in the database in /in/a1khU on line 3 Fatal error: Uncaught TypeError: DatePeriod::__construct() accepts (DateTimeInterface, DateInterval, int [, int]), or (DateTimeInterface, DateInterval, DateTime [, int]), or (string [, int]) as arguments in /in/a1khU:5 Stack trace: #0 /in/a1khU(5): DatePeriod->__construct(false, Object(DateInterval), false) #1 {main} thrown in /in/a1khU on line 5
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught DateMalformedStringException: DateTime::modify(): Failed to parse time string (first day of current month) at position 13 (c): The timezone could not be found in the database in /in/a1khU:2 Stack trace: #0 /in/a1khU(2): DateTime->modify('first day of cu...') #1 {main} thrown in /in/a1khU on line 2
Process exited with code 255.

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:
51.3 ms | 401 KiB | 8 Q