3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class TimeCurrency { public static function createFromString(string $formatted): self { if (!preg_match('/^(\d{4}):(\d{2}):(\d{1}):(\d{2}):(\d{2})$/', $formatted, $matches)) { throw new \InvalidArgumentException('Invalid currency format.'); } return new self(...array_slice($matches, 1)); } /** @var int */ private $year; /** @var int */ private $weekNumber; /** @var int */ private $day; /** @var int */ private $hour; /** @var int */ private $minute; public function __construct(int $year, int $weekNumber, int $day, int $hour, int $minute) { $this->year = $year; $this->weekNumber = $weekNumber; $this->day = $day; $this->hour = $hour; $this->minute = $minute; } public function addYears(int $addedYears): void { $this->year += $addedYears; } public function __toString(): string { return sprintf('%04d:%02d:%d:%02d:%02d', $this->year, $this->weekNumber, $this->day, $this->hour, $this->minute); } } // Example usage $currency = TimeCurrency::createFromString('2010:21:1:23:21'); $currency->addYears(4); echo $currency;

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.5.30.0100.00819.30
8.5.20.0110.00719.48
8.5.10.0110.00621.36
8.5.00.0140.00720.29
8.4.180.0110.01121.70
8.4.170.0150.00820.51
8.4.160.0140.00824.00
8.4.150.0080.00417.00
8.4.140.0170.00417.71
8.4.130.0090.01018.91
8.4.120.0070.00724.12
8.4.110.0080.01220.55
8.4.100.0150.00718.49
8.4.90.0090.01220.51
8.4.80.0100.00418.75
8.4.70.0060.00318.85
8.4.60.0080.00918.90
8.4.50.0100.00618.73
8.4.40.0130.00720.61
8.4.30.0120.00922.32
8.4.20.0140.00718.75
8.4.10.0130.00622.61
8.3.300.0130.00720.82
8.3.290.0090.01220.94
8.3.280.0140.00818.54
8.3.270.0090.01116.84
8.3.260.0120.00816.80
8.3.250.0110.00819.10
8.3.240.0110.00817.12
8.3.230.0050.00316.66
8.3.220.0050.01019.09
8.3.210.0100.01116.69
8.3.200.0060.00416.87
8.3.190.0130.00617.17
8.3.180.0080.00019.13
8.3.170.0040.01516.78
8.3.160.0090.00917.20
8.3.150.0080.00416.88
8.3.140.0030.00620.58
8.3.130.0070.00418.69
8.3.120.0030.00720.49
8.3.110.0060.00320.94
8.3.100.0040.01524.06
8.3.90.0100.01026.77
8.3.80.0050.00518.62
8.3.70.0100.01018.52
8.3.60.0100.00616.75
8.3.50.0110.00318.62
8.3.40.0150.00618.68
8.3.30.0120.00318.95
8.3.20.0000.00821.72
8.3.10.0040.00421.94
8.3.00.0000.00822.43
8.2.300.0120.01422.26
8.2.290.0120.00720.27
8.2.280.0100.00818.64
8.2.270.0100.01016.68
8.2.260.0090.00916.48
8.2.250.0120.00916.95
8.2.240.0130.00318.83
8.2.230.0050.00322.58
8.2.220.0030.00637.54
8.2.210.0040.00426.77
8.2.200.0040.00818.79
8.2.190.0120.00316.58
8.2.180.0100.00718.41
8.2.170.0070.01419.16
8.2.160.0070.00720.30
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0080.00026.16
8.2.110.0070.00422.20
8.2.100.0120.00018.29
8.2.90.0040.00418.03
8.2.80.0030.00618.05
8.2.70.0050.00518.05
8.2.60.0030.00518.14
8.2.50.0000.00818.10
8.2.40.0000.00821.15
8.2.30.0040.00419.29
8.2.20.0000.00718.23
8.2.10.0050.00318.99
8.2.00.0000.00719.26
8.1.340.0100.00917.67
8.1.330.0050.00721.88
8.1.320.0100.00516.36
8.1.310.0090.01216.37
8.1.300.0130.00618.17
8.1.290.0030.00630.84
8.1.280.0090.00625.92
8.1.270.0040.00420.70
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0000.00922.63
8.1.230.0050.00520.85
8.1.220.0040.00417.78
8.1.210.0000.00918.87
8.1.200.0100.00017.48
8.1.190.0040.00417.48
8.1.180.0050.00318.10
8.1.170.0040.00420.71
8.1.160.0050.00318.99
8.1.150.0000.00819.00
8.1.140.0040.00418.94
8.1.130.0060.00320.18
8.1.120.0000.00717.65
8.1.110.0000.00817.63
8.1.100.0000.00717.50
8.1.90.0000.00817.67
8.1.80.0040.00417.61
8.1.70.0090.00317.64
8.1.60.0000.00817.65
8.1.50.0050.00517.65
8.1.40.0060.00317.71
8.1.30.0030.00617.81
8.1.20.0030.00617.73
8.1.10.0040.00417.81
8.1.00.0030.00517.71
8.0.300.0000.00721.77
8.0.290.0030.00617.00
8.0.280.0040.00418.50
8.0.270.0030.00317.32
8.0.260.0070.00020.05
8.0.250.0040.00417.09
8.0.240.0040.00417.16
8.0.230.0000.00717.02
8.0.220.0030.00317.10
8.0.210.0070.00017.09
8.0.200.0060.00017.02
8.0.190.0040.00417.14
8.0.180.0000.00817.08
8.0.170.0050.00317.14
8.0.160.0020.00517.14
8.0.150.0050.00316.99
8.0.140.0040.00416.91
8.0.130.0000.00513.54
8.0.120.0000.00716.99
8.0.110.0040.00417.07
8.0.100.0070.00017.11
8.0.90.0080.00017.24
8.0.80.0060.01217.13
8.0.70.0070.00017.00
8.0.60.0030.00517.03
8.0.50.0040.00416.95
8.0.30.0190.00617.34
8.0.20.0070.01117.31
8.0.10.0040.00417.11
8.0.00.0120.00616.96
7.4.330.0000.00515.55
7.4.320.0000.00716.81
7.4.300.0030.00316.65
7.4.290.0040.00416.82
7.4.280.0080.00316.63
7.4.270.0000.00716.89
7.4.260.0070.00013.52
7.4.250.0030.00316.76
7.4.240.0060.00316.78
7.4.230.0050.00216.63
7.4.220.0040.00416.86
7.4.210.0080.01116.78
7.4.200.0040.00416.65
7.4.130.0100.00716.68
7.4.120.0190.01116.89
7.4.110.0110.00716.81
7.4.100.0100.01316.80
7.4.90.0060.01216.58
7.4.80.0100.00619.39
7.4.70.0120.00616.71
7.4.60.0060.01116.72
7.4.50.0090.00916.77
7.4.40.0080.01116.63
7.4.00.0040.01115.18
7.3.330.0000.00716.47
7.3.320.0000.00513.39
7.3.310.0080.00016.41
7.3.300.0050.00316.46
7.3.290.0000.00716.30
7.3.260.0100.00816.57
7.3.240.0080.01016.78
7.3.230.0150.00316.76
7.3.210.0100.00716.52
7.3.200.0030.01316.65
7.3.190.0080.00816.39
7.3.180.0100.00616.70
7.3.170.0090.00616.70
7.3.160.0110.00616.46
7.3.120.0060.00915.13
7.3.110.0080.00814.67
7.3.100.0040.00914.99
7.3.90.0090.00515.04
7.3.80.0030.01215.21
7.3.70.0040.00914.87
7.3.60.0080.00514.91
7.3.50.0020.01415.04
7.3.40.0050.01314.84
7.3.30.0080.00414.87
7.3.20.0070.00915.82
7.3.10.0070.00915.76
7.3.00.0060.00715.97
7.2.330.0090.01016.80
7.2.320.0040.01216.87
7.2.310.0070.00716.61
7.2.300.0120.00916.92
7.2.290.0040.01416.77
7.2.250.0070.01115.12
7.2.240.0030.01515.33
7.2.230.0050.00915.29
7.2.220.0100.00315.17
7.2.210.0070.00615.23
7.2.200.0050.00915.00
7.2.190.0030.01115.06
7.2.180.0070.01215.09
7.2.170.0050.01215.26
7.2.160.0070.00715.27
7.2.150.0060.00915.15
7.2.140.0000.01415.50
7.2.130.0060.00914.98
7.2.120.0110.00315.29
7.2.110.0030.01215.22
7.2.100.0040.01115.22
7.2.90.0060.00915.31
7.2.80.0060.00915.16
7.2.70.0030.01215.15
7.2.60.0110.00415.51
7.2.50.0130.00015.05
7.2.40.0110.00415.38
7.2.30.0070.00715.22
7.2.20.0110.00415.23
7.2.10.0000.01415.37
7.2.00.0110.00315.36
7.1.330.0100.00514.93
7.1.320.0120.00215.02
7.1.310.0100.00714.97
7.1.300.0090.00715.05
7.1.290.0070.01215.10
7.1.280.0080.00314.81
7.1.270.0070.00514.81
7.1.260.0030.00814.91
7.1.250.0070.00713.89

preferences:
45.93 ms | 1472 KiB | 5 Q