3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ContractVersion { private $end_date; public function __construct(\DateTimeImmutable $end_date) { $this->end_date = $end_date; } public function getEndDate(): \DateTimeImmutable { return $this->end_date; } } class VersionedContract { private $versions = []; public function __construct(\DateTimeImmutable $end_date) { $this->versions[] = new ContractVersion($end_date); } public function getEndDate(): \DateTimeImmutable { return $this->getCurrentVersion()->getEndDate(); } private function getCurrentVersion(): ContractVersion { return end($this->versions); } public function renew(\DateInterval $interval) { $this->versions[] = new ContractVersion($this->getEndDate()->add($interval)); } } $contract = new VersionedContract(new \DateTimeImmutable('2017-10-10 10:10:00')); var_dump($contract->getEndDate()); // string(26) "2017-10-10 10:10:00.000000" $endDate = $contract->getEndDate(); var_dump($endDate); // same string(26) "2017-10-10 10:10:00.000000" $endDate->add(new \DateInterval('P1Y')); var_dump($endDate); // "2017-10-10 10:10:00.000000" var_dump($contract->getEndDate());

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.3.60.0140.00718.56
8.3.50.0120.00616.64
8.3.40.0140.00718.90
8.3.30.0090.00618.84
8.3.20.0040.00420.33
8.3.10.0000.00823.70
8.3.00.0030.00622.00
8.2.180.0040.01116.75
8.2.170.0040.01122.96
8.2.160.0100.00319.15
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00420.95
8.2.120.0040.00426.35
8.2.110.0080.00421.17
8.2.100.0060.00619.57
8.2.90.0030.00519.22
8.2.80.0040.00418.05
8.2.70.0030.00917.63
8.2.60.0050.00318.04
8.2.50.0000.00818.10
8.2.40.0040.00420.30
8.2.30.0040.00421.00
8.2.20.0040.00418.01
8.2.10.0060.00318.25
8.2.00.0000.00818.05
8.1.280.0100.00625.92
8.1.270.0060.00322.10
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00621.43
8.1.230.0070.00417.76
8.1.220.0040.00417.79
8.1.210.0000.00818.77
8.1.200.0100.00317.60
8.1.190.0090.00017.35
8.1.180.0060.00318.10
8.1.170.0030.00618.96
8.1.160.0070.00019.10
8.1.150.0040.00420.57
8.1.140.0040.00419.50
8.1.130.0000.00718.92
8.1.120.0000.00717.50
8.1.110.0040.00817.59
8.1.100.0050.00317.65
8.1.90.0040.00417.68
8.1.80.0040.00417.63
8.1.70.0000.00717.62
8.1.60.0030.00517.73
8.1.50.0080.00017.66
8.1.40.0040.00417.55
8.1.30.0030.00517.69
8.1.20.0030.00517.63
8.1.10.0040.00417.72
8.1.00.0000.00817.65
8.0.300.0000.00820.14
8.0.290.0040.00416.75
8.0.280.0000.00718.45
8.0.270.0000.00717.20
8.0.260.0030.00317.09
8.0.250.0030.00317.18
8.0.240.0000.00717.18
8.0.230.0070.00017.18
8.0.220.0000.00817.09
8.0.210.0040.00417.04
8.0.200.0040.00417.05
8.0.190.0030.00517.14
8.0.180.0000.00717.13
8.0.170.0050.00217.02
8.0.160.0070.00016.99
8.0.150.0050.00317.02
8.0.140.0030.00317.07
8.0.130.0030.00313.43
8.0.120.0030.00517.07
8.0.110.0070.00017.14
8.0.100.0080.00016.91
8.0.90.0020.00517.16
8.0.80.0030.01317.04
8.0.70.0040.00417.10
8.0.60.0050.00217.13
8.0.50.0040.00417.04
8.0.30.0060.01017.29
8.0.20.0150.00717.40
8.0.10.0000.00717.05
8.0.00.0140.00316.79
7.4.330.0030.00315.55
7.4.320.0000.00616.48
7.4.300.0000.00616.75
7.4.290.0030.00316.79
7.4.280.0000.00716.65
7.4.270.0030.00316.57
7.4.260.0000.00513.36
7.4.250.0000.00716.57
7.4.240.0050.00216.66
7.4.230.0000.00716.86
7.4.220.0040.01816.58
7.4.210.0060.00916.60
7.4.200.0000.00716.49
7.4.160.0110.00516.68
7.4.150.0100.00717.40
7.4.140.0090.01217.86
7.4.130.0170.00616.57
7.4.120.0090.01016.59
7.4.110.0070.01016.73
7.4.100.0070.01616.63
7.4.90.0200.00016.48
7.4.80.0070.01019.39
7.4.70.0100.01316.49
7.4.60.0020.01516.69
7.4.50.0000.01216.68
7.4.40.0070.01616.49
7.4.30.0190.00016.71
7.4.00.0030.01014.86
7.3.330.0000.00613.41
7.3.320.0030.00313.28
7.3.310.0070.00016.39
7.3.300.0000.00716.32
7.3.290.0090.00616.46
7.3.280.0090.01016.42
7.3.270.0070.01117.40
7.3.260.0070.01116.58
7.3.250.0080.01116.48
7.3.240.0110.00916.58
7.3.230.0110.00916.53
7.3.210.0070.01016.62
7.3.200.0000.01716.58
7.3.190.0100.00716.62
7.3.180.0030.01316.59
7.3.170.0060.01016.57
7.3.160.0090.01516.78
7.3.10.0100.00916.67
7.3.00.0120.00516.72
7.2.330.0130.00516.91
7.2.320.0140.00616.54
7.2.310.0120.00416.66
7.2.300.0150.00616.62
7.2.290.0090.00916.95
7.2.130.0070.00916.76
7.2.120.0070.01216.79
7.2.110.0030.01316.91
7.2.100.0110.00716.67
7.2.90.0060.01116.30
7.2.80.0120.00716.03
7.2.70.0080.01216.35
7.2.60.0140.00616.44
7.2.50.0130.01016.16
7.2.40.0380.00616.14
7.2.30.0260.00516.20
7.2.20.0080.00916.20
7.2.10.0060.01116.21
7.2.00.0240.00616.34
7.1.250.0080.00815.77
7.1.210.0870.00314.08
7.1.200.0110.00413.87
7.1.190.0120.01213.78
7.1.180.0410.00813.93
7.1.170.0380.01214.06
7.1.160.0540.00313.87
7.1.150.1210.00613.73
7.1.140.0210.00714.01
7.1.130.0070.00714.10
7.1.120.1160.00014.09
7.1.110.0780.00614.14
7.1.100.1350.00313.81
7.1.90.0170.00014.20
7.1.80.0730.00314.18
7.1.70.0860.00314.07
7.1.60.0840.00732.11
7.1.50.0950.01032.04
7.1.40.0720.00632.02
7.1.30.0330.00931.80
7.1.20.0300.01731.91
7.1.10.1630.01014.10
7.1.00.0120.01214.16
7.0.310.0370.00913.57
7.0.300.0270.01013.29
7.0.290.0160.00513.48
7.0.280.0070.00713.65
7.0.270.0310.00913.43
7.0.260.1420.00713.57
7.0.250.1170.00713.43
7.0.240.1070.00913.68
7.0.230.0730.00013.63
7.0.220.0630.01013.34
7.0.210.0930.00313.72
7.0.200.0360.00313.72
7.0.190.0270.00713.73
7.0.180.1110.01013.36
7.0.170.1460.00713.88
7.0.160.0060.01413.82
7.0.150.1730.00313.59
7.0.140.1030.00613.93
7.0.130.0110.01113.65
7.0.120.0140.00313.46
7.0.110.0160.00513.52
7.0.100.0460.00013.90
7.0.90.0700.00713.80
7.0.80.0100.00713.98
7.0.70.0120.00313.92
7.0.60.0660.01013.61
7.0.50.0730.00313.98
7.0.40.0740.00013.86
7.0.30.0660.00913.89
7.0.20.0750.00913.86
7.0.10.0800.00713.88
7.0.00.0770.00813.79

preferences:
74.07 ms | 400 KiB | 5 Q