3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ "<p>We've been in business since 1998 and produced this logo design [2002] years ago.</p>", "<p>We've been in business since 1998 and produced this logo design [2017] years ago.</p>" ]; foreach ($strings as $string) { preg_match('/\[(\d{4})\] years/', $string, $matches); $years = date('Y') - $matches[1]; $result = sprintf("%s year%s", $years, $years === 1 ? "": "s" ); echo str_replace($matches[0], $result, $string) . 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.130.0110.01017.91
8.4.120.0090.01120.64
8.4.110.0110.00922.29
8.4.100.0090.01118.02
8.4.90.0100.01118.70
8.4.80.0050.00518.13
8.4.70.0120.00917.93
8.4.60.0060.00618.88
8.4.50.0040.00618.29
8.4.40.0030.01617.94
8.4.30.0080.01119.79
8.4.20.0130.00720.46
8.4.10.0090.00017.75
8.3.260.0120.00716.82
8.3.250.0050.01018.88
8.3.240.0130.00616.92
8.3.230.0110.00916.86
8.3.220.0110.00717.38
8.3.210.0130.00517.05
8.3.200.0030.00516.91
8.3.190.0130.00917.12
8.3.180.0090.00620.86
8.3.170.0070.01117.24
8.3.160.0060.00316.63
8.3.150.0130.00717.39
8.3.140.0080.00018.72
8.3.130.0060.00316.95
8.3.120.0040.00420.79
8.3.110.0060.00318.49
8.3.100.0030.00516.79
8.3.90.0080.00026.77
8.3.80.0090.00017.97
8.3.70.0070.01116.63
8.3.60.0110.00718.55
8.3.50.0080.00818.45
8.3.40.0150.00319.08
8.3.30.0040.01119.09
8.3.20.0040.00420.16
8.3.10.0030.00623.66
8.3.00.0050.00319.81
8.2.290.0100.01020.73
8.2.280.0120.00720.50
8.2.270.0040.00419.29
8.2.260.0070.00722.38
8.2.250.0090.00916.69
8.2.240.0060.00317.14
8.2.230.0040.00420.94
8.2.220.0030.00616.87
8.2.210.0040.00426.77
8.2.200.0030.00618.54
8.2.190.0110.01116.75
8.2.180.0150.00018.52
8.2.170.0170.00022.96
8.2.160.0070.00720.32
8.2.150.0090.00024.18
8.2.140.0020.00524.66
8.2.130.0040.00426.16
8.2.120.0040.00421.16
8.2.110.0030.00622.14
8.2.100.0120.00317.78
8.2.90.0050.00319.35
8.2.80.0050.00317.97
8.2.70.0060.00318.00
8.2.60.0050.00317.93
8.2.50.0050.00518.07
8.2.40.0050.00318.43
8.2.30.0030.00519.88
8.2.20.0040.00418.22
8.2.10.0000.00818.29
8.2.00.0050.00218.38
8.1.330.0150.00422.05
8.1.320.0140.00716.48
8.1.310.0110.00717.01
8.1.300.0000.00818.66
8.1.290.0060.00330.84
8.1.280.0080.00625.92
8.1.270.0040.00423.79
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0090.00022.67
8.1.230.0070.00717.83
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0060.00317.60
8.1.190.0040.00417.60
8.1.180.0040.00418.10
8.1.170.0080.00018.76
8.1.160.0000.00718.98
8.1.150.0000.00720.21
8.1.140.0000.00717.80
8.1.130.0030.00319.10
8.1.120.0070.00317.64
8.1.110.0040.00417.77
8.1.100.0040.00417.71
8.1.90.0040.00417.72
8.1.80.0000.00817.64
8.1.70.0070.00017.67
8.1.60.0070.00017.86
8.1.50.0040.00417.71
8.1.40.0080.00017.72
8.1.30.0050.00317.78
8.1.20.0000.00717.82
8.1.10.0040.00417.67
8.1.00.0000.00717.75
8.0.300.0000.00918.77
8.0.290.0080.00016.88
8.0.280.0000.00818.41
8.0.270.0070.00017.34
8.0.260.0020.00517.17
8.0.250.0040.00417.19
8.0.240.0040.00417.34
8.0.230.0030.00517.15
8.0.220.0000.00717.13
8.0.210.0030.00417.24
8.0.200.0000.00817.12
8.0.190.0000.00717.20
8.0.180.0040.00417.02
8.0.170.0060.00917.21
8.0.160.0000.00717.09
8.0.150.0000.00717.14
8.0.140.0060.00317.07
8.0.130.0050.00013.54
8.0.120.0040.00417.04
8.0.110.0040.00417.20
8.0.100.0040.00417.06
8.0.90.0000.00817.05
8.0.80.0130.00317.14
8.0.70.0040.00417.13
8.0.60.0000.00917.18
8.0.50.0040.00417.05
8.0.30.0100.00717.46
8.0.20.0100.00917.43
8.0.10.0040.00417.42
8.0.00.0100.01017.17
7.4.330.0000.00515.55
7.4.320.0030.00316.78
7.4.300.0060.00016.79
7.4.290.0040.00416.68
7.4.280.0040.00416.92
7.4.270.0000.01016.86
7.4.260.0050.00216.86
7.4.250.0030.00316.84
7.4.240.0000.00716.85
7.4.230.0030.00316.78
7.4.220.0070.00016.88
7.4.210.0100.00716.81
7.4.200.0040.00416.77
7.4.160.0100.00716.78
7.4.150.0060.01217.40
7.4.140.0100.01117.86
7.4.130.0090.01416.89
7.4.120.0140.00816.92
7.4.110.0160.00616.95
7.4.100.0100.00716.65
7.4.90.0120.00616.68
7.4.80.0090.01419.39
7.4.70.0190.00016.84
7.4.60.0110.00717.01
7.4.50.0040.01116.76
7.4.40.0070.01516.66
7.4.00.0130.00315.36
7.3.330.0050.00013.41
7.3.320.0030.00313.39
7.3.310.0070.00016.45
7.3.300.0040.00416.41
7.3.290.0030.00316.47
7.3.280.0100.00616.54
7.3.270.0160.00317.40
7.3.260.0100.01116.76
7.3.240.0120.00516.62
7.3.230.0070.01017.05
7.3.210.0080.00816.59
7.3.200.0030.01216.56
7.3.190.0100.00616.90
7.3.180.0100.00716.71
7.3.170.0100.00616.53
7.3.160.0060.01016.80
7.3.10.0110.00417.07
7.3.00.0060.00816.79
7.2.330.0140.01116.91
7.2.320.0090.00917.03
7.2.310.0100.00716.92
7.2.300.0090.00916.86
7.2.290.0120.00616.79
7.2.130.0040.00916.98
7.2.120.0000.01317.12
7.2.110.0030.01017.15
7.2.100.0060.00517.23
7.2.90.0040.01117.13
7.2.80.0030.00817.33
7.2.70.0070.00917.31
7.2.60.0030.01117.29
7.2.50.0050.01116.97
7.2.40.0060.01017.12
7.2.30.0070.00717.25
7.2.20.0130.00917.49
7.2.10.0160.00617.64
7.2.00.0090.01117.57
7.1.250.0060.00716.20
7.1.240.0060.00316.28
7.1.230.0000.01016.36
7.1.220.0040.00816.07
7.1.210.0080.00816.11
7.1.200.0070.00416.04
7.1.190.0060.00316.04
7.1.180.0030.00616.19
7.1.170.0090.00616.22
7.1.160.0030.00716.03
7.1.150.0040.00416.26
7.1.140.1280.00916.50
7.1.130.0160.00616.82
7.1.120.0160.00816.58
7.1.110.0120.00616.19
7.1.100.0110.00816.32
7.1.90.0140.01116.23
7.1.80.0190.00716.42
7.1.70.0130.00915.87
7.1.60.0270.00724.63
7.1.50.0180.01024.39
7.1.40.0260.00424.28
7.1.30.0290.00524.18
7.1.20.0190.00824.30
7.1.10.0160.01115.53
7.1.00.0140.01115.75
7.0.330.0000.01015.82
5.6.380.0070.00714.46

preferences:
30.18 ms | 403 KiB | 5 Q