3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timezoneUtc = new DateTimeZone('UTC'); $timezoneBerlin = new DateTimeZone('Europe/Berlin'); $timezoneAmsterdam = new DateTimeZone('Europe/Amsterdam'); $dateTimeA = new DateTimeImmutable('2025-03-30 00:00:00', $timezoneUtc); $dateTimeB = new DateTimeImmutable('2025-03-31 00:00:00', $timezoneUtc); $dateTimeC = new DateTimeImmutable('2025-03-29 00:00:00', $timezoneBerlin); $dateTimeD = new DateTimeImmutable('2025-03-31 00:00:00', $timezoneBerlin); $dateTimeE = new DateTimeImmutable('2025-03-29 00:00:00', $timezoneAmsterdam); $dateTimeF = new DateTimeImmutable('2025-03-31 00:00:00', $timezoneAmsterdam); function toIntervalSpecification(DateInterval $interval): string { $specification = 'P'; $specification .= $interval->y ? $interval->y . 'Y' : ''; $specification .= $interval->m ? $interval->m . 'M' : ''; $specification .= $interval->d ? $interval->d . 'D' : ''; if ($interval->h ?? $interval->i ?? $interval->s ?? 0) { $specification .= 'T'; $specification .= $interval->h ? $interval->h . 'H' : ''; $specification .= $interval->i ? $interval->i . 'M' : ''; $specification .= $interval->s ? $interval->s . 'S' : ''; } if ($specification[-1] === 'P') { $specification = 'PT0S'; } return $specification; } $diffTwoTimezoneSameDstRulesA = $dateTimeC->diff($dateTimeF, true); $diffTwoTimezoneSameDstRulesB = $dateTimeF->diff($dateTimeC, true); $diffTwoTimezoneSameDstRulesC = $dateTimeE->diff($dateTimeD, true); $diffTwoTimezoneSameDstRulesD = $dateTimeD->diff($dateTimeE, true); echo toIntervalSpecification($diffTwoTimezoneSameDstRulesA) . PHP_EOL; echo toIntervalSpecification($diffTwoTimezoneSameDstRulesB) . PHP_EOL; echo toIntervalSpecification($diffTwoTimezoneSameDstRulesC) . PHP_EOL; echo toIntervalSpecification($diffTwoTimezoneSameDstRulesD) . PHP_EOL;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.120.0140.00620.32
8.4.110.0090.01118.68
8.4.100.0110.01017.89
8.4.90.0120.00917.98
8.4.80.0290.01019.72
8.4.70.0200.01119.75
8.4.60.0210.00317.66
8.4.50.0380.00717.58
8.4.40.0200.00417.80
8.4.30.0450.01017.77
8.4.20.0390.00917.91
8.4.10.0320.00517.64
8.3.250.0040.00517.54
8.3.240.0050.00516.88
8.3.230.0110.00916.67
8.3.220.0080.00416.97
8.3.210.0110.00316.97
8.3.200.0190.00316.97
8.3.190.0190.00316.97
8.3.180.0170.00516.97
8.3.170.0200.00716.97
8.3.160.0220.00316.97
8.3.150.0340.00916.97
8.3.140.0200.00316.97
8.3.130.0180.00216.97
8.3.120.0170.00316.97
8.3.110.0280.00616.97
8.3.100.0460.01116.97
8.3.90.0380.01016.97
8.3.80.0430.00816.97
8.3.70.0260.00516.97
8.3.60.0200.00716.97
8.3.50.0170.00616.97
8.3.40.0140.00717.98
8.3.30.0150.00417.55
8.3.20.0380.00717.89
8.3.10.0330.00717.46
8.3.00.0220.00917.91
8.2.290.0150.00418.71
8.2.280.0230.00816.97
8.2.270.0360.00716.97
8.2.260.0430.01116.97
8.2.250.0320.01116.97
8.2.240.0360.00816.97
8.2.230.0330.01116.97
8.2.220.0390.00516.97
8.2.210.0330.01016.97
8.2.200.0360.00616.97
8.2.190.0340.00916.97
8.2.180.0320.01016.97
8.2.170.0440.00617.82
8.2.160.0360.00917.93
8.2.150.0350.00617.82
8.2.140.0400.01117.57
8.2.130.0240.00617.70
8.2.120.0160.00817.35
8.2.110.0210.00917.76
8.2.100.0220.00817.78
8.2.90.0210.00717.77
8.2.80.0170.00417.82
8.2.70.0300.00517.79
8.2.60.0240.00417.62
8.2.50.0340.01017.70
8.2.40.0360.00717.86
8.2.30.0380.00717.75
8.2.20.0330.00917.76
8.2.10.0320.01017.55
8.2.00.0390.00817.64

preferences:
31.59 ms | 403 KiB | 5 Q