3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $start_date = new DateTimeImmutable("2015-6-30"); $dates = new DatePeriod( $start_date, new DateInterval("P1Y"), 21 ); var_dump($dates->next()); var_dump($dates->current()); var_dump($dates->next()); var_dump($dates->current()); foreach($dates as $dt) { var_dump($dt->format("d/m/Y")); }
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method DatePeriod::next() in /in/RunqJ:10 Stack trace: #0 {main} thrown in /in/RunqJ on line 10
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Call to undefined method DatePeriod::next() in /in/RunqJ on line 10
Process exited with code 255.
Output for 5.3.22 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/RunqJ on line 3
Process exited with code 255.