3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'The ID is \$ID and name is \$name'; $row = [ 'ID'=> 5, 'name' => 'delboy1978uk', ]; function replaceStuff($string, $row) { preg_match_all('#\\$\w+#', $string, $matches); foreach ($matches[0] as $match) { $key = str_replace('$', '', $match); $replace = '\\'.$match; $string = str_replace($replace, $row[$key], $string); } return $string; } echo replaceStuff($string, $row);

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.00719.52
8.5.20.0080.01018.81
8.5.10.0110.00816.82
8.5.00.0140.00720.38
8.4.180.0090.01319.90
8.4.170.0120.01020.54
8.4.160.0140.00822.17
8.4.150.0070.00616.97
8.4.140.0130.00817.78
8.4.130.0120.00817.82
8.4.120.0130.00820.59
8.4.110.0100.01122.63
8.4.100.0120.00917.87
8.4.90.0120.01018.84
8.4.80.0070.00519.76
8.4.70.0050.00418.21
8.4.60.0070.01318.85
8.4.50.0120.00823.93
8.4.40.0080.00317.87
8.4.30.0170.00319.55
8.4.20.0170.00317.75
8.4.10.0030.00719.72
8.3.300.0110.00920.85
8.3.290.0120.01020.95
8.3.280.0160.01218.45
8.3.270.0110.00916.71
8.3.260.0110.00716.66
8.3.250.0060.00218.97
8.3.240.0090.01017.31
8.3.230.0100.01116.65
8.3.220.0020.00617.34
8.3.210.0120.00816.54
8.3.200.0060.00316.79
8.3.190.0130.00717.11
8.3.180.0070.00818.57
8.3.170.0090.00917.28
8.3.160.0140.00320.86
8.3.150.0070.01318.41
8.3.140.0030.00617.33
8.3.130.0040.00418.51
8.3.120.0100.00018.91
8.3.110.0050.00520.94
8.3.100.0120.00324.06
8.3.90.0070.01126.77
8.3.80.0060.00318.68
8.3.70.0110.00416.88
8.3.60.0070.01118.56
8.3.50.0120.00717.46
8.3.40.0060.00918.70
8.3.30.0120.00318.92
8.3.20.0080.00020.20
8.3.10.0030.00620.80
8.3.00.0050.00320.84
8.2.300.0080.01322.06
8.2.290.0080.01120.79
8.2.280.0040.00518.57
8.2.270.0110.00717.21
8.2.260.0120.00318.77
8.2.250.0030.00617.13
8.2.240.0030.00618.97
8.2.230.0030.00622.58
8.2.220.0040.00437.54
8.2.210.0040.01126.77
8.2.200.0030.00916.63
8.2.190.0110.00416.58
8.2.180.0040.01117.00
8.2.170.0150.00022.96
8.2.160.0070.00722.20
8.2.150.0120.00324.18
8.2.140.0000.00724.66
8.2.130.0050.00219.32
8.2.120.0080.00026.35
8.2.110.0000.01020.95
8.2.100.0060.00618.09
8.2.90.0060.00319.16
8.2.80.0030.00518.05
8.2.70.0080.00017.88
8.2.60.0090.00017.93
8.2.50.0000.00818.10
8.2.40.0040.00422.19
8.2.30.0000.00819.21
8.2.20.0000.00818.08
8.2.10.0070.00018.16
8.2.00.0040.00418.04
8.1.340.0030.00817.90
8.1.330.0080.01022.24
8.1.320.0120.00916.37
8.1.310.0040.01118.54
8.1.300.0090.00018.38
8.1.290.0060.00330.84
8.1.280.0140.00325.92
8.1.270.0070.00021.82
8.1.260.0070.00026.35
8.1.250.0100.00028.09
8.1.240.0090.00021.36
8.1.230.0110.00019.12
8.1.220.0050.00317.75
8.1.210.0000.00818.77
8.1.200.0100.00017.36
8.1.190.0040.00417.36
8.1.180.0040.00418.10
8.1.170.0000.00818.68
8.1.160.0040.00419.14
8.1.150.0040.00418.84
8.1.140.0000.00719.70
8.1.130.0060.00317.72
8.1.120.0050.00317.59
8.1.110.0050.00317.48
8.1.100.0000.00917.68
8.1.90.0000.00817.56
8.1.80.0050.00317.60
8.1.70.0040.00417.52
8.1.60.0030.00517.72
8.1.50.0060.00317.60
8.1.40.0060.00617.55
8.1.30.0000.00817.79
8.1.20.0000.00817.83
8.1.10.0000.00717.58
8.1.00.0000.00717.61
8.0.300.0070.00018.77
8.0.290.0000.00816.88
8.0.280.0040.00418.49
8.0.270.0030.00317.27
8.0.260.0030.00316.89
8.0.250.0030.00317.08
8.0.240.0060.00317.08
8.0.230.0040.00417.06
8.0.220.0000.00817.00
8.0.210.0080.00017.07
8.0.200.0030.00316.97
8.0.190.0030.00617.03
8.0.180.0000.00716.95
8.0.170.0040.00417.08
8.0.160.0070.00017.10
8.0.150.0070.00017.00
8.0.140.0000.00717.04
8.0.130.0000.00513.42
8.0.120.0040.00416.98
8.0.110.0070.00016.82
8.0.100.0000.00817.09
8.0.90.0000.00717.06
8.0.80.0100.00716.95
8.0.70.0050.00216.87
8.0.60.0070.00016.82
8.0.50.0080.00017.05
8.0.30.0110.00817.21
8.0.20.0110.00717.42
8.0.10.0030.00517.04
8.0.00.0080.01216.77
7.4.330.0000.00515.55
7.4.320.0030.00316.70
7.4.300.0050.00216.73
7.4.290.0070.00016.69
7.4.280.0000.00916.46
7.4.270.0000.00816.81
7.4.260.0050.00216.80
7.4.250.0000.00816.74
7.4.240.0040.00416.81
7.4.230.0040.00416.55
7.4.220.0080.01116.81
7.4.210.0070.01416.90
7.4.200.0000.00716.59
7.4.160.0130.00316.61
7.4.150.0200.00317.40
7.4.140.0140.00617.86
7.4.130.0150.00416.64
7.4.120.0130.00816.66
7.4.110.0140.00416.84
7.4.100.0090.01016.67
7.4.90.0100.00816.52
7.4.80.0070.01019.39
7.4.70.0070.01416.65
7.4.60.0080.00816.65
7.4.50.0060.01016.63
7.4.40.0090.00816.61
7.4.30.0030.01416.78
7.4.00.0090.00914.88
7.3.330.0000.00513.37
7.3.320.0050.00013.33
7.3.310.0030.00316.38
7.3.300.0000.00716.35
7.3.290.0090.00916.47
7.3.280.0110.00616.44
7.3.270.0130.01017.40
7.3.260.0120.00416.62
7.3.250.0040.01416.55
7.3.240.0060.01216.57
7.3.230.0100.00716.81
7.3.210.0100.00616.51
7.3.200.0000.01516.62
7.3.190.0030.01416.63
7.3.180.0150.00616.46
7.3.170.0030.01316.74
7.3.160.0080.00816.66
7.3.50.0100.00314.89
7.3.40.0040.00914.71
7.3.30.0090.00315.12
7.3.20.0100.01014.96
7.3.10.0060.01115.68
7.3.00.0100.00915.86
7.2.330.0000.01816.98
7.2.320.0090.00916.83
7.2.310.0100.00716.90
7.2.300.0130.01016.87
7.2.290.0100.01016.70
7.2.180.0160.00015.19
7.2.170.0030.01315.24
7.2.160.0040.01214.94
7.2.150.0100.00715.31
7.2.140.0140.00715.32
7.2.130.0050.00915.86
7.2.120.0150.00716.12
7.2.110.0120.00516.21
7.2.100.0110.01015.88
7.2.90.0120.00615.96
7.2.80.0100.00915.98
7.2.70.0090.00816.03
7.2.60.0200.00716.26
7.2.50.0140.00616.04
7.2.40.0120.00516.04
7.2.30.0120.00516.11
7.2.20.0080.01016.04
7.2.10.0040.01016.06
7.2.00.0340.00216.23
7.1.280.0090.00914.04
7.1.270.0120.01613.88
7.1.260.0150.00314.28
7.1.250.0090.00514.92
7.1.240.0230.01214.24
7.1.230.0160.00814.34
7.1.220.0170.01414.19
7.1.210.0160.01314.29
7.1.200.0110.00915.11
7.1.190.0280.01114.27
7.1.180.0150.01213.84
7.1.170.0120.02014.14
7.1.160.0200.00314.23
7.1.150.0260.00614.28
7.1.140.0170.00814.14
7.1.130.0210.00414.05
7.1.120.0200.01414.21
7.1.110.0300.00214.16
7.1.100.0100.00813.98
7.1.90.0180.00413.95
7.1.80.0230.01013.93
7.1.70.0470.00714.57
7.1.60.0670.00323.87
7.1.50.0610.01123.68
7.1.40.0570.01723.47
7.1.30.0700.00923.39
7.1.20.0540.01223.71
7.1.10.0530.00514.53
7.1.00.0590.01114.69
7.0.330.0160.01313.72
7.0.320.0200.01213.64
7.0.310.0110.01813.76
7.0.300.0110.00913.50
7.0.290.0150.00413.70
7.0.280.0240.00813.70
7.0.270.0070.01413.51
7.0.260.0280.01113.69
7.0.250.0110.00713.71
7.0.240.0150.00813.62
7.0.230.0150.01513.69
7.0.220.0200.00813.53
7.0.210.0130.01013.75
7.0.200.0590.00714.35
7.0.190.0610.01114.33
7.0.180.1490.00614.23
7.0.170.0590.00914.20
7.0.160.0830.00814.16
7.0.150.0510.01014.10
7.0.140.0490.00614.24
7.0.130.0590.00714.29
7.0.120.0480.01214.37
7.0.110.0490.01314.28
7.0.100.0450.01114.15
7.0.90.0470.01214.15
7.0.80.0470.01114.01
7.0.70.0430.01714.30
7.0.60.0580.00914.22
7.0.50.0390.00914.37
7.0.40.0420.00514.40
7.0.30.0500.00514.50
7.0.20.0550.00814.34
7.0.10.0630.00314.08
7.0.00.0560.00614.27
5.6.400.0100.02114.59
5.6.390.0200.01014.47
5.6.380.0230.00814.59

preferences:
287.65 ms | 1700 KiB | 5 Q