3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hello = 'Hi'; $name = 'ken'; $replacements = [ 'hello' => 'morning', 'invoiceno' => 1234 ]; $msg = '$hello, $name (JX02), Your Orders $invoiceno has been delivered. $test $123,99 $123.99 Thank you.'; $result = preg_replace_callback('/\$([\w\_-]{1,})/', function ($match) use ($replacements) { return array_key_exists($match[1], $replacements) ? $replacements[$match[1]] : ( isset($GLOBALS[$match[1]]) ? $GLOBALS[$match[1]] : '$'.$match[1] ); }, $msg); echo $result;

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.0100.00918.09
8.4.120.0120.00820.43
8.4.110.0100.00818.97
8.4.100.0080.00318.21
8.4.90.0030.00619.69
8.4.80.0130.00918.13
8.4.70.0150.00618.10
8.4.60.0150.00618.86
8.4.50.0130.00819.83
8.4.40.0060.00319.70
8.4.30.0120.00320.36
8.4.20.0110.00818.76
8.4.10.0170.00317.95
8.3.260.0140.00616.55
8.3.250.0120.00817.35
8.3.240.0150.00416.78
8.3.230.0130.00716.73
8.3.220.0060.00217.41
8.3.210.0070.00716.66
8.3.200.0050.00316.80
8.3.190.0080.00419.23
8.3.180.0060.00118.70
8.3.170.0110.00719.01
8.3.160.0080.00018.48
8.3.150.0100.01320.64
8.3.140.0080.00016.67
8.3.130.0080.00018.52
8.3.120.0000.00818.73
8.3.110.0030.00620.94
8.3.100.0060.00324.06
8.3.90.0050.00326.77
8.3.80.0030.00616.88
8.3.70.0040.01116.63
8.3.60.0120.00318.43
8.3.50.0110.00618.09
8.3.40.0070.00719.10
8.3.30.0080.00818.97
8.3.20.0050.00320.65
8.3.10.0030.00521.95
8.3.00.0000.00822.58
8.2.290.0050.00518.80
8.2.280.0080.01120.30
8.2.270.0120.00617.40
8.2.260.0070.00719.13
8.2.250.0000.00818.64
8.2.240.0060.00317.55
8.2.230.0120.00322.58
8.2.220.0040.00437.54
8.2.210.0070.01126.77
8.2.200.0000.00816.88
8.2.190.0100.01017.00
8.2.180.0130.01018.54
8.2.170.0090.00622.96
8.2.160.0060.00920.43
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0040.00419.81
8.2.110.0030.00620.35
8.2.100.0040.00718.03
8.2.90.0050.00317.88
8.2.80.0040.00418.05
8.2.70.0060.00317.93
8.2.60.0080.00018.16
8.2.50.0000.00818.10
8.2.40.0040.00419.47
8.2.30.0020.00519.36
8.2.20.0000.00918.03
8.2.10.0040.00419.53
8.2.00.0030.00319.34
8.1.330.0110.00816.14
8.1.320.0110.00816.61
8.1.310.0040.00420.34
8.1.300.0060.00316.18
8.1.290.0030.00618.88
8.1.280.0070.01025.92
8.1.270.0070.01020.77
8.1.260.0050.00326.35
8.1.250.0050.00228.09
8.1.240.0030.00623.85
8.1.230.0040.00720.86
8.1.220.0030.00517.74
8.1.210.0050.00318.78
8.1.200.0030.00617.35
8.1.190.0000.00817.36
8.1.180.0060.00318.10
8.1.170.0000.00818.73
8.1.160.0030.00718.91
8.1.150.0000.00718.82
8.1.140.0000.00722.04
8.1.130.0030.00620.16
8.1.120.0040.00417.58
8.1.110.0040.00417.62
8.1.100.0040.00417.50
8.1.90.0080.00017.61
8.1.80.0040.00417.69
8.1.70.0000.00717.56
8.1.60.0050.00317.63
8.1.50.0030.00517.61
8.1.40.0000.00917.57
8.1.30.0080.00017.84
8.1.20.0040.00417.81
8.1.10.0020.00517.65
8.1.00.0080.00017.68
8.0.300.0000.00719.75
8.0.290.0060.00316.88
8.0.280.0070.00018.43
8.0.270.0050.00217.26
8.0.260.0030.00320.12
8.0.250.0030.00317.07
8.0.240.0000.00717.04
8.0.230.0000.00716.94
8.0.220.0000.00717.00
8.0.210.0040.00417.04
8.0.200.0000.00717.10
8.0.190.0070.00017.13
8.0.180.0040.00417.11
8.0.170.0000.00817.09
8.0.160.0040.00416.95
8.0.150.0030.00717.04
8.0.140.0050.00217.03
8.0.130.0060.00013.55
8.0.120.0000.00817.02
8.0.110.0050.00217.10
8.0.100.0000.00717.08
8.0.90.0000.00916.93
8.0.80.0000.01417.03
8.0.70.0030.00517.09
8.0.60.0030.00517.04
8.0.50.0030.00316.91
8.0.30.0090.00917.48
8.0.20.0140.00517.14
8.0.10.0070.00017.03
8.0.00.0120.00616.94
7.4.330.0050.00015.55
7.4.320.0000.00616.77
7.4.300.0000.00716.83
7.4.290.0040.00416.72
7.4.280.0050.00316.65
7.4.270.0040.00416.59
7.4.260.0000.00513.59
7.4.250.0030.00316.79
7.4.240.0020.00516.73
7.4.230.0030.00316.71
7.4.220.0020.00516.69
7.4.210.0040.01316.67
7.4.200.0070.00016.79
7.4.130.0100.01016.90
7.4.120.0120.00916.56
7.4.110.0100.00716.54
7.4.100.0070.01016.84
7.4.90.0120.00916.70
7.4.80.0120.00619.39
7.4.70.0060.01516.60
7.4.60.0130.00316.81
7.4.50.0090.00616.75
7.4.40.0030.01216.69
7.4.00.0060.00914.79
7.3.330.0000.00716.37
7.3.320.0030.00313.37
7.3.310.0070.00016.56
7.3.300.0070.00016.58
7.3.290.0080.00016.52
7.3.280.0070.01016.52
7.3.260.0100.01016.67
7.3.240.0070.01216.55
7.3.230.0100.00716.76
7.3.210.0160.00016.45
7.3.200.0130.00316.43
7.3.190.0070.01116.77
7.3.180.0110.01116.66
7.3.170.0150.00616.72
7.3.160.0100.00716.53
7.3.100.0040.01115.06
7.3.90.0110.01614.99
7.3.80.0030.01214.95
7.3.70.0060.01015.07
7.3.60.0060.00915.01
7.3.50.0110.00515.02
7.3.40.0060.00914.94
7.3.30.0070.00714.63
7.3.20.0680.01214.79
7.3.10.0130.01315.07
7.3.00.0640.01014.86
7.2.330.0090.01316.61
7.2.320.0100.00716.80
7.2.310.0130.00316.86
7.2.300.0030.02116.79
7.2.290.0070.01116.73
7.2.220.0120.00615.03
7.2.210.0150.00315.12
7.2.200.0130.00415.20
7.2.190.0060.00915.16
7.2.180.0100.00515.18
7.2.170.0120.00315.09
7.2.160.0160.00615.21
7.2.150.0480.01615.18
7.2.140.0570.00614.84
7.2.130.0510.00315.18
7.2.120.0490.01014.98
7.2.110.0740.00615.26
7.2.100.0710.00715.01
7.2.90.0690.00715.22
7.2.80.0450.01215.24
7.2.70.0500.01014.98
7.2.60.0570.01815.32
7.2.50.0440.01615.21
7.2.40.0520.00815.14
7.2.30.0820.01415.15
7.2.20.0160.01215.00
7.2.10.0300.00015.00
7.2.00.0500.00615.23
7.1.320.0680.01113.91
7.1.310.0680.00314.35
7.1.300.0470.01214.11
7.1.290.0580.00613.80
7.1.280.0620.00914.02
7.1.270.0930.01014.01
7.1.260.0190.00313.99
7.1.250.0530.00914.25

preferences:
29.14 ms | 403 KiB | 5 Q