3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replaceValues(array $kvPairs, string $text): string { return preg_replace_callback( '/{{\s*(.*?)\s*}}/', fn($m) => isset($kvPairs[strtolower($m[1])]) ? '<span class="attr">' . $kvPairs[strtolower($m[1])] . '</span>' : '<span class="attrUnknown">' . $m[1] . '</span>', $text ); } $translations = [ 'date' => '1977-05-20', 'time' => '01:02:03', 'bar' => 'Fighters', ]; echo replaceValues($translations, "Your tickets to the Foo {{ Bar}} were purchased @ {{dAte }} {{ tiME }}");

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.0110.00924.09
8.4.110.0150.00819.84
8.4.100.0140.00618.93
8.4.90.0100.00722.51
8.4.80.0120.00820.43
8.4.70.0150.00818.36
8.4.60.0110.01118.91
8.4.50.0120.00917.70
8.4.40.0050.00518.21
8.4.30.0090.00920.85
8.4.20.0170.00324.06
8.4.10.0100.01023.72
8.3.250.0150.00418.88
8.3.240.0070.01217.37
8.3.230.0120.00816.67
8.3.220.0030.00418.97
8.3.210.0080.01216.68
8.3.200.0040.00516.35
8.3.190.0150.00517.03
8.3.180.0090.00616.84
8.3.170.0140.00418.86
8.3.160.0040.00420.29
8.3.150.0150.00318.44
8.3.140.0000.01517.14
8.3.130.0050.00318.50
8.3.120.0130.00720.63
8.3.110.0130.00620.94
8.3.100.0000.00824.06
8.3.90.0060.00326.77
8.3.80.0060.00317.97
8.3.70.0180.00316.87
8.3.60.0130.01018.30
8.3.50.0160.00316.63
8.3.40.0110.00420.09
8.3.30.0110.00418.93
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0060.00320.63
8.2.280.0100.00918.82
8.2.270.0140.00019.20
8.2.260.0180.00018.52
8.2.250.0060.01217.12
8.2.240.0030.00617.17
8.2.230.0000.01522.58
8.2.220.0060.00337.54
8.2.210.0090.00926.77
8.2.200.0050.00516.63
8.2.190.0110.00716.88
8.2.180.0150.00616.88
8.2.170.0040.01122.96
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0050.00326.16
8.2.110.0090.00020.55
8.2.100.0090.00317.84
8.2.90.0000.00817.75
8.2.80.0040.00418.94
8.2.70.0090.00017.88
8.2.60.0080.00017.75
8.2.50.0000.00917.88
8.2.40.0100.00717.63
8.2.30.0130.00617.73
8.2.20.0130.00317.62
8.2.10.0140.00317.63
8.2.00.0090.00617.63
8.1.330.0110.00722.03
8.1.320.0130.00716.29
8.1.310.0110.00418.59
8.1.300.0050.00517.97
8.1.290.0090.00030.84
8.1.280.0150.00425.92
8.1.270.0070.01123.53
8.1.260.0050.00326.35
8.1.250.0060.00328.09
8.1.240.0140.00721.95
8.1.230.0040.00823.89
8.1.220.0060.00318.80
8.1.210.0060.00319.15
8.1.200.0000.00817.61
8.1.190.0050.00517.48
8.1.180.0030.00518.10
8.1.170.0100.00717.62
8.1.160.0030.01417.62
8.1.150.0140.00417.62
8.1.140.0050.01617.62
8.1.130.0120.00617.62
8.1.120.0110.00717.62
8.1.110.0140.00317.62
8.1.100.0070.01017.62
8.1.90.0110.00517.62
8.1.80.0110.00517.62
8.1.70.0130.00617.62
8.1.60.0140.00417.62
8.1.50.0170.00017.63
8.1.40.0140.00517.62
8.1.30.0110.00617.62
8.1.20.0090.00917.62
8.1.10.0090.00917.62
8.1.00.0140.00417.63
8.0.300.0000.00820.06
8.0.290.0050.00316.88
8.0.280.0090.00917.62
8.0.270.0110.00617.62
8.0.260.0080.00817.62
8.0.250.0090.00717.62
8.0.240.0110.00617.62
8.0.230.0160.00017.62
8.0.220.0190.00017.62
8.0.210.0170.00017.62
8.0.200.0120.00417.62
8.0.190.0140.00317.62
8.0.180.0050.01117.62
8.0.170.0160.00017.62
8.0.160.0150.00317.62
8.0.150.0090.00717.62
8.0.140.0070.01017.62
8.0.130.0040.01217.62
8.0.120.0190.00017.62
8.0.110.0080.00817.62
8.0.100.0110.00517.62
8.0.90.0120.00417.62
8.0.80.0100.00717.62
8.0.70.0090.00617.62
8.0.60.0090.00917.62
8.0.50.0110.00717.62
8.0.30.0120.00417.62
8.0.20.0060.00917.62
8.0.10.0150.00017.62

preferences:
25.4 ms | 403 KiB | 5 Q