3v4l.org

run code in 300+ PHP versions simultaneously
<?php function template($template, $vals) { $matches = array(); $regex = "/\{\{(\S+)\}\}/e"; $rendered = $template; // in case no matches are found preg_match_all($regex, $template, $matches, PREG_OFFSET_CAPTURE, 3); foreach ($matches[0] as $found) { $block = $found[0]; $offset = $found[0]; $k = str_replace('{{', '', $block); $k = str_replace('}-}', '', $k); $rendered = preg_replace($regex, '$vals[\\1]', $template); } return $rendered; } $template = "test {{ME}}."; $vals = array('beep'); echo template($template, $vals);

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.3.60.0110.00716.50
8.3.50.0140.01521.16
8.3.40.0150.00618.97
8.3.30.0070.00718.84
8.3.20.0040.00420.01
8.3.10.0040.00423.72
8.3.00.0070.00023.48
8.2.180.0150.00718.41
8.2.170.0120.00419.01
8.2.160.0100.00322.96
8.2.150.0030.00625.66
8.2.140.0030.00624.66
8.2.130.0040.00419.76
8.2.120.0080.00026.35
8.2.110.0080.00321.00
8.2.100.0090.00319.63
8.2.90.0050.00317.88
8.2.80.0000.00817.97
8.2.70.0030.00618.03
8.2.60.0040.00418.05
8.2.50.0030.00518.10
8.2.40.0070.00320.59
8.2.30.0050.00320.77
8.2.20.0000.00717.72
8.2.10.0020.00518.26
8.2.00.0040.00418.06
8.1.280.0080.00825.92
8.1.270.0030.00622.08
8.1.260.0060.00328.09
8.1.250.0080.00028.09
8.1.240.0060.00320.82
8.1.230.0110.00021.04
8.1.220.0040.00417.76
8.1.210.0050.00318.77
8.1.200.0060.00317.22
8.1.190.0080.00017.23
8.1.180.0080.00018.10
8.1.170.0000.00818.50
8.1.160.0040.00420.75
8.1.150.0040.00418.84
8.1.140.0080.00019.62
8.1.130.0000.00717.80
8.1.120.0040.00417.54
8.1.110.0090.00317.52
8.1.100.0040.00417.55
8.1.90.0050.00317.43
8.1.80.0000.00817.54
8.1.70.0040.00417.39
8.1.60.0040.00417.61
8.1.50.0030.00617.54
8.1.40.0030.00717.55
8.1.30.0030.00517.62
8.1.20.0040.00417.66
8.1.10.0040.00417.49
8.1.00.0000.00817.55
8.0.300.0040.00419.88
8.0.290.0060.00316.75
8.0.280.0030.00318.46
8.0.270.0000.00717.40
8.0.260.0060.00017.30
8.0.250.0030.00317.08
8.0.240.0060.00316.96
8.0.230.0000.00717.04
8.0.220.0000.00716.98
8.0.210.0000.00717.02
8.0.200.0060.00017.04
8.0.190.0000.00917.03
8.0.180.0000.00716.98
8.0.170.0000.00717.01
8.0.160.0040.00416.96
8.0.150.0040.00416.97
8.0.140.0000.00716.79
8.0.130.0030.00313.38
8.0.120.0040.00416.87
8.0.110.0040.00416.88
8.0.100.0000.00717.05
8.0.90.0050.00316.81
8.0.80.0120.00316.96
8.0.70.0000.00717.01
8.0.60.0040.00416.90
8.0.50.0000.00816.87
8.0.30.0090.01317.02
8.0.20.0170.00517.40
8.0.10.0050.00317.01
8.0.00.0120.00816.74
7.4.330.0000.00516.73
7.4.320.0000.00616.64
7.4.300.0000.00616.44
7.4.290.0000.00716.54
7.4.280.0000.01116.44
7.4.270.0050.00216.66
7.4.260.0040.00416.57
7.4.250.0040.00416.49
7.4.240.0000.00816.47
7.4.230.0040.00416.44
7.4.220.0030.01416.65
7.4.210.0070.01016.72
7.4.200.0080.00016.52
7.4.160.0110.00616.52
7.4.150.0100.00717.40
7.4.140.0160.00417.86
7.4.130.0060.01116.46
7.4.120.0090.00916.50
7.4.110.0110.00716.63
7.4.100.0060.01116.45
7.4.90.0100.00716.63
7.4.80.0030.01419.39
7.4.70.0100.00716.66
7.4.60.0110.00716.41
7.4.50.0070.00716.75
7.4.40.0110.00816.48
7.4.30.0120.00316.48
7.4.10.0100.01015.05
7.4.00.0050.01114.97
7.3.330.0030.00313.18
7.3.320.0040.00413.39
7.3.310.0040.00416.40
7.3.300.0040.00416.29
7.3.290.0070.00016.31
7.3.280.0120.00616.42
7.3.270.0130.00417.40
7.3.260.0100.00716.50
7.3.250.0130.00616.55
7.3.240.0100.01216.43
7.3.230.0030.01416.48
7.3.210.0130.01016.20
7.3.200.0040.01219.39
7.3.190.0090.00916.77
7.3.180.0080.00816.48
7.3.170.0060.00916.28
7.3.160.0070.01016.60
7.3.130.0040.01514.86
7.3.120.0080.01014.63
7.3.110.0100.00714.74
7.3.100.0050.00914.72
7.3.90.0080.00615.04
7.3.80.0070.00914.85
7.3.70.0020.01314.61
7.3.60.0030.01314.91
7.3.50.0050.00714.74
7.3.40.0040.01114.72
7.3.30.0020.01214.81
7.3.20.0060.00816.64
7.3.10.0060.00816.60
7.3.00.0090.00616.50
7.2.330.0160.00616.88
7.2.320.0140.00916.91
7.2.310.0030.01416.84
7.2.300.0100.01316.74
7.2.290.0120.00416.95
7.2.260.0030.01715.18
7.2.250.0030.01715.07
7.2.240.0040.01114.96
7.2.230.0070.01015.14
7.2.220.0110.00615.06
7.2.210.0070.01215.03
7.2.200.0080.00814.99
7.2.190.0080.00515.22
7.2.180.0030.01015.17
7.2.170.0050.00915.17
7.2.160.0080.00815.14
7.2.150.0090.00617.00
7.2.140.0070.00817.11
7.2.130.0090.00617.17
7.2.120.0090.00817.24
7.2.110.0050.01217.00
7.2.100.0060.00617.17
7.2.90.0040.01017.04
7.2.80.0050.01116.94
7.2.70.0060.01117.16
7.2.60.0040.01116.95
7.2.50.0070.01017.18
7.2.40.0100.00517.01
7.2.30.0050.00917.23
7.2.20.0110.00617.24
7.2.10.0090.00517.09
7.2.00.0090.00817.13
7.1.330.0020.01115.91
7.1.320.0080.00715.94
7.1.310.0110.00715.99
7.1.300.0080.00615.80
7.1.290.0090.00515.71
7.1.280.0030.01215.81
7.1.270.0080.00915.97
7.1.260.0110.00715.96
7.1.250.0040.00915.99
7.1.240.0090.00016.02
7.1.230.0030.00616.09
7.1.220.0100.00315.77
7.1.210.0060.00616.00
7.1.200.0050.00616.09
7.1.190.0070.01016.11
7.1.180.0000.00915.95
7.1.170.0070.00716.13
7.1.160.0040.00815.82
7.1.150.0060.01015.81
7.1.140.0100.00316.06
7.1.130.0050.00515.82
7.1.120.0000.01516.05
7.1.110.0090.00315.94
7.1.100.0030.00917.14
7.1.90.0060.00315.99
7.1.80.0030.00915.91
7.1.70.0050.00516.75
7.1.60.0070.00817.51
7.1.50.0040.01316.37
7.1.40.0090.00616.00
7.1.30.0140.00316.04
7.1.20.0090.00615.77
7.1.10.0040.00815.80
7.1.00.0060.04119.12
7.0.330.0030.00615.55
7.0.320.0100.00315.50
7.0.310.0090.00315.45
7.0.300.0080.00815.60
7.0.290.0000.01315.58
7.0.280.0070.00715.69
7.0.270.0000.01015.55
7.0.260.0000.01415.12
7.0.250.0100.00015.69
7.0.240.0000.01315.64
7.0.230.0030.00915.59
7.0.220.0100.00315.51
7.0.210.0030.00915.29
7.0.200.0060.00616.25
7.0.190.0100.00015.23
7.0.180.0070.00715.41
7.0.170.0100.00315.78
7.0.160.0100.00715.52
7.0.150.0070.00715.37
7.0.140.0080.00415.58
7.0.130.0080.00415.64
7.0.120.0080.00415.81
7.0.110.0030.00915.68
7.0.100.0120.00315.72
7.0.90.0040.01115.57
7.0.80.0060.00915.65
7.0.70.0070.00715.44
7.0.60.0030.04818.62
7.0.50.0060.02416.73
7.0.40.0090.03216.90
7.0.30.0290.03516.94
7.0.20.0200.03516.84
7.0.10.0130.03316.85
7.0.00.0050.04516.98
5.6.400.0030.01214.61
5.6.390.0030.00914.77
5.6.380.0040.01114.66
5.6.370.0040.01214.45
5.6.360.0030.00814.18
5.6.350.0060.00614.63
5.6.340.0070.00714.18
5.6.330.0030.01014.41
5.6.320.0080.00814.04
5.6.310.0040.01114.06
5.6.300.0080.00514.06
5.6.290.0030.00614.31
5.6.280.0050.02017.61
5.6.270.0040.01114.45
5.6.260.0030.01414.51
5.6.250.0000.01414.63
5.6.240.0030.00814.48
5.6.230.0040.00714.46
5.6.220.0080.00414.23
5.6.210.0170.02717.42
5.6.200.0090.04516.39
5.6.190.0030.02517.58
5.6.180.0290.03117.50
5.6.170.0140.04617.43
5.6.160.0130.04017.40
5.6.150.0050.04616.35
5.6.140.0030.04816.25
5.6.130.0000.05316.34
5.6.120.0080.04317.76
5.6.110.0100.04217.61
5.6.100.0050.03717.70
5.6.90.0050.05117.76
5.6.80.0050.04517.29
5.6.70.0030.01414.24
5.6.60.0000.00914.13
5.6.50.0060.00614.59
5.6.40.0100.00314.27
5.6.30.0030.01214.45
5.6.20.0060.00914.25
5.6.10.0040.00414.71
5.6.00.0060.00314.44
5.5.380.0040.01114.36
5.5.370.0070.00714.42
5.5.360.0040.01114.17
5.5.350.0110.02817.29
5.5.340.0090.04316.32
5.5.330.0070.04717.25
5.5.320.0080.03017.19
5.5.310.0300.04017.23
5.5.300.0070.04316.28
5.5.290.0040.04816.19
5.5.280.0100.04017.63
5.5.270.0090.02717.43
5.5.260.0020.02917.58
5.5.250.0100.03017.47
5.5.240.0130.04017.29
5.5.230.0070.00314.16
5.5.220.0000.01014.31
5.5.210.0070.00714.12
5.5.200.0080.00814.15
5.5.190.0040.00814.17
5.5.180.0030.00914.36
5.5.170.0030.01314.14
5.5.160.0030.01014.18
5.5.150.0080.00814.16
5.5.140.0000.01414.59
5.5.130.0040.01414.08
5.5.120.0060.00314.35
5.5.110.0100.00314.43
5.5.100.0030.00614.36
5.5.90.0030.01314.40
5.5.80.0070.00714.35
5.5.70.0060.00914.27
5.5.60.0120.00314.29
5.5.50.0070.00714.26
5.5.40.0050.00814.16
5.5.30.0070.00714.15
5.5.20.0100.00314.10
5.5.10.0070.00714.18
5.5.00.0060.00314.32

preferences:
38.34 ms | 401 KiB | 5 Q