run code in 300+ PHP versions simultaneously
<?php $timezone = new DateTimeZone( "UTC" ); $fmj = DateInterval::createFromDateString( 'first Monday of January next year' ); //Monday from start 2019 only $period = new DatePeriod( new DateTime( '2019-01-01 00:00:00.000000', $timezone ), $fmj, new DateTime( '2022-01-11 00:00:00.000000', $timezone ) ); //$period->current= new \DateTime('2019-05-06 00:00:00', new \DateTimeZone('UTC')); $y = 0; foreach ( $period as $dt ) { $c[] = $period; $display[$y++] = $dt->format( "l Y-m-d H:i:s" ); //stop total_recurrence if( $y == 5 ) { break; } } $var = new DateTime( 'first monday of January', new DateTimeZone( "UTC" )); $display[5] = $var->format( "l Y-m-d H:i:s" ); var_dump( $display, $fmj, $c);
Output for git.master
Warning: DateInterval::createFromDateString(): String 'first Monday of January next year' contains non-relative elements in /in/uJpiU on line 4 Fatal error: Uncaught TypeError: DatePeriod::__construct() accepts (DateTimeInterface, DateInterval, int [, int]), or (DateTimeInterface, DateInterval, DateTime [, int]), or (string [, int]) as arguments in /in/uJpiU:6 Stack trace: #0 /in/uJpiU(6): DatePeriod->__construct(Object(DateTime), false, Object(DateTime)) #1 {main} thrown in /in/uJpiU on line 6
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

12.15 ms | 409 KiB | 5 Q