3v4l.org

run code in 300+ PHP versions simultaneously
<?php function updateYear(string $text, int $newYear): string { $year = null; $result = preg_replace_callback( '/(\-)(\d\d\d\d)/', function (array $matches) use ($newYear, &$year): string { $year = (int) $matches[2]; return $matches[1] . (string) $newYear; }, $text ); return "Replaced {$year} in '{$text} => '{$result}'"; } echo updateYear('(c) 1970-2022', 2023) . PHP_EOL; echo updateYear('(c) 1999-2022', 2023) . 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.10.0070.01323.83
8.3.140.0090.00017.50
8.3.130.0050.00318.57
8.3.120.0030.00618.98
8.3.110.0060.00320.94
8.3.100.0000.00924.06
8.3.90.0000.01526.77
8.3.80.0090.00018.43
8.3.70.0150.00016.63
8.3.60.0090.00616.88
8.3.50.0090.00616.94
8.3.40.0080.01220.29
8.3.30.0150.00018.75
8.3.20.0030.00624.18
8.3.10.0040.00424.66
8.3.00.0070.00026.16
8.2.260.0000.00818.72
8.2.250.0030.00518.59
8.2.240.0080.01118.80
8.2.230.0040.00422.58
8.2.220.0030.01337.54
8.2.210.0050.00326.77
8.2.200.0030.00716.75
8.2.190.0080.00818.54
8.2.180.0130.00918.41
8.2.170.0070.01422.96
8.2.160.0000.01722.96
8.2.150.0080.00025.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00221.06
8.2.110.0070.00321.19
8.2.100.0110.00018.03
8.2.90.0040.00418.22
8.2.80.0050.00518.34
8.2.70.0040.00417.88
8.2.60.0040.00417.75
8.2.50.0030.00517.75
8.2.40.0000.00817.88
8.2.30.0000.00818.05
8.2.20.0050.00519.43
8.2.10.0070.00018.14
8.2.00.0000.00919.67
8.1.310.0100.00718.21
8.1.300.0080.00018.29
8.1.290.0060.00930.84
8.1.280.0060.01325.92
8.1.270.0080.00024.66
8.1.260.0140.00326.35
8.1.250.0040.00428.09
8.1.240.0090.00022.48
8.1.230.0040.00822.63
8.1.220.0050.00517.78
8.1.210.0030.00618.82
8.1.200.0070.00317.48
8.1.190.0040.00817.24
8.1.180.0060.00318.10
8.1.170.0000.00817.62
8.1.160.0040.00418.83
8.1.150.0040.00418.75
8.1.140.0090.00017.66
8.1.130.0040.00519.39
8.1.120.0070.00219.40
8.1.110.0000.01019.42
8.1.100.0060.00319.46
8.1.90.0030.00619.37
8.1.80.0030.00617.71
8.1.70.0060.00319.44
8.1.60.0050.00519.58
8.1.50.0030.00619.46
8.1.40.0040.00417.73
8.1.30.0030.00517.80
8.1.20.0040.00417.86
8.1.10.0000.00817.75
8.1.00.0000.00817.55
8.0.300.0030.00520.02
8.0.290.0050.00316.88
8.0.280.0030.00318.20
8.0.270.0030.00718.06
8.0.260.0030.00618.68
8.0.250.0030.00518.88
8.0.240.0030.00317.41
8.0.230.0040.00417.41
8.0.220.0020.00517.41
8.0.210.0000.00717.41
8.0.200.0000.00717.41
8.0.190.0050.00317.41
8.0.180.0000.00717.41
8.0.170.0040.00417.41
8.0.160.0040.00417.41
8.0.150.0030.00617.41
8.0.140.0000.00717.41
8.0.130.0050.00317.41
8.0.120.0050.00317.41
8.0.110.0050.00517.41
8.0.100.0040.00417.41
8.0.90.0030.00617.41
8.0.80.0000.00917.41
8.0.70.0030.00517.41
8.0.60.0040.00417.41
8.0.50.0040.00418.66
8.0.30.0000.00717.41
8.0.20.0020.00517.41
8.0.10.0040.00417.41

preferences:
27.61 ms | 403 KiB | 5 Q