3v4l.org

run code in 300+ PHP versions simultaneously
<?php $interval = new DateInterval('PT1H'); // DST change in Europe is on the 30. October 2016 $dateTimeStart = new DateTimeImmutable('2016-10-30 01:30:00', new DateTimezone('Europe/Berlin')); $dateTimeEnd = new DateTimeImmutable('2016-10-30 03:31:00', new DateTimezone('Europe/Berlin')); $period = new DatePeriod($dateTimeStart, $interval, $dateTimeEnd); foreach ($period as $date) { echo $date->format('c') . "\n"; }
Output for 8.1.7 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
2016-10-30T01:30:00+02:00 2016-10-30T02:30:00+02:00 2016-10-30T03:30:00+01:00
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 2016-10-30T01:30:00+02:00 2016-10-30T02:30:00+02:00 2016-10-30T03:30:00+01:00
Output for 5.5.8 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.6
2016-10-30T01:30:00+02:00 2016-10-30T02:30:00+01:00 2016-10-30T03:30:00+01:00
Output for 5.5.0 - 5.5.7
Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.' in /in/2aDp3:8 Stack trace: #0 /in/2aDp3(8): DatePeriod->__construct(Object(DateTimeImmutable), Object(DateInterval), Object(DateTimeImmutable)) #1 {main} thrown in /in/2aDp3 on line 8
Process exited with code 255.

preferences:
206.03 ms | 402 KiB | 255 Q