3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startDate = "2019-02-01"; $endDate = "2019-03-04"; date_default_timezone_set('UTC'); $zones = [ 'UTC', 'Etc/GMT+12', // west 'Etc/GMT-12', // east 'Cuba', // west 'Japan', // east 'Atlantic/Azores', // west 'Europe/Berlin', // east ]; foreach ($zones as $zoneName) { $zone = timezone_open($zoneName); $diff = date_create($startDate, $zone)->diff(date_create($endDate, $zone)); $test = date_create($startDate, $zone)->add($diff); printf('test: %s expected: %s diff->days: %s zone: %s %s', $test->format('Y-m-d\TH:i:s'), $endDate, $diff->days, $zone->getName(), "\r\n"); }
Output for git.master, git.master_jit, rfc.property-hooks
test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: UTC test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: Etc/GMT+12 test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: Etc/GMT-12 test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: Cuba test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: Japan test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: Atlantic/Azores test: 2019-03-04T00:00:00 expected: 2019-03-04 diff->days: 31 zone: Europe/Berlin

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:
61.24 ms | 402 KiB | 8 Q