3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MicroTemplateEngine { public $data = array(); private $tpl; function __construct($f) { $this->tpl = $f; } function __set($name, $value) { $this->data[$name] = $value; } function __toString() { $out = $this->tpl; foreach ($this->data as $_key => $_value) { $out = str_replace('#{{' . $_key . '}}', $_value, $out); } $out = preg_replace('/#{{.*?}}/' , '' , $out ); return $out; } } $t = new MicroTemplateEngine('<#{{element}} id="element-#{{id}}">#{{inner}}</#{{element}}>'); $t->data = (object)array('element'=> 'span', 'id'=>45, 'inner' => 'Teste templating engine!'); var_dump($t); echo $t;

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.0150.00618.43
8.3.50.0100.01022.05
8.3.40.0090.00618.80
8.3.30.0070.00719.27
8.3.20.0080.00020.34
8.3.10.0000.00721.80
8.3.00.0000.00918.04
8.2.180.0130.01017.00
8.2.170.0110.00322.96
8.2.160.0030.01422.30
8.2.150.0050.00324.18
8.2.140.0170.00324.66
8.2.130.0000.00726.16
8.2.120.0040.00421.27
8.2.110.0030.00722.02
8.2.100.0120.00018.09
8.2.90.0040.00419.07
8.2.80.0060.00318.00
8.2.70.0080.00017.75
8.2.60.0110.00017.80
8.2.50.0070.00218.07
8.2.40.0000.00918.22
8.2.30.0000.00718.27
8.2.20.0040.00417.80
8.2.10.0070.00018.00
8.2.00.0040.00418.04
8.1.280.0100.01025.92
8.1.270.0050.00323.88
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0000.01022.10
8.1.230.0110.00019.15
8.1.220.0080.00017.74
8.1.210.0030.00618.77
8.1.200.0100.00017.38
8.1.190.0060.00317.38
8.1.180.0030.00618.10
8.1.170.0000.00818.74
8.1.160.0040.00422.05
8.1.150.0050.00219.02
8.1.140.0000.00817.57
8.1.130.0030.00317.83
8.1.120.0000.00717.69
8.1.110.0040.00417.45
8.1.100.0000.00817.46
8.1.90.0000.00717.62
8.1.80.0000.00817.63
8.1.70.0030.00317.61
8.1.60.0030.00517.71
8.1.50.0080.00017.66
8.1.40.0040.00417.65
8.1.30.0040.00417.80
8.1.20.0000.00817.71
8.1.10.0040.00417.80
8.1.00.0040.00417.64
8.0.300.0070.00018.77
8.0.290.0040.00416.88
8.0.280.0060.00318.45
8.0.270.0040.00417.22
8.0.260.0060.00017.34
8.0.250.0030.00317.14
8.0.240.0000.00717.05
8.0.230.0030.00317.19
8.0.220.0030.00317.03
8.0.210.0000.00817.12
8.0.200.0030.00317.14
8.0.190.0030.00517.25
8.0.180.0050.00217.13
8.0.170.0050.00317.03
8.0.160.0070.00017.05
8.0.150.0050.00317.03
8.0.140.0000.00817.04
8.0.130.0030.00313.51
8.0.120.0040.00417.08
8.0.110.0040.00416.95
8.0.100.0000.00716.96
8.0.90.0000.00717.01
8.0.80.0110.00417.18
8.0.70.0000.00817.19
8.0.60.0000.00717.23
8.0.50.0000.00916.98
8.0.30.0110.01217.44
8.0.20.0110.00817.41
8.0.10.0070.00017.21
8.0.00.0090.00816.83
7.4.330.0050.00015.04
7.4.320.0030.00516.84
7.4.300.0070.00016.64
7.4.290.0000.00916.84
7.4.280.0030.00816.64
7.4.270.0030.00516.86
7.4.260.0000.00716.71
7.4.250.0040.00416.63
7.4.240.0050.00316.75
7.4.230.0050.00216.71
7.4.220.0110.00716.75
7.4.210.0040.01116.86
7.4.200.0000.00716.64
7.4.160.0100.00516.82
7.4.150.0130.01317.40
7.4.140.0150.01317.86
7.4.130.0080.00916.82
7.4.120.0110.00916.81
7.4.110.0110.00716.80
7.4.100.0110.00716.92
7.4.90.0070.01016.68
7.4.80.0090.00919.39
7.4.70.0060.01216.65
7.4.60.0090.00916.73
7.4.50.0030.00716.62
7.4.40.0100.01316.59
7.4.30.0100.00616.87
7.4.10.0090.00915.42
7.4.00.0050.01115.13
7.3.330.0070.00013.38
7.3.320.0050.00013.52
7.3.310.0070.00016.52
7.3.300.0040.00416.49
7.3.290.0080.00816.52
7.3.280.0050.01416.53
7.3.270.0040.01317.40
7.3.260.0110.01416.78
7.3.250.0100.01016.51
7.3.240.0080.00816.71
7.3.230.0140.00416.56
7.3.210.0150.00416.50
7.3.200.0110.00719.39
7.3.190.0070.01616.84
7.3.180.0090.00916.48
7.3.170.0080.01416.58
7.3.160.0110.00516.59
7.3.130.0070.01015.14
7.3.120.0090.00514.99
7.3.110.0070.00915.17
7.3.100.0090.00614.87
7.3.90.0030.01015.12
7.3.80.0040.00714.99
7.3.70.0080.00314.88
7.3.60.0050.00715.15
7.3.50.0050.00715.03
7.3.40.0050.00814.81
7.3.30.0030.01214.76
7.3.20.0090.00516.97
7.3.10.0050.00916.72
7.3.00.0040.01116.85
7.2.330.0150.00316.95
7.2.320.0120.00616.82
7.2.310.0140.00316.80
7.2.300.0140.00316.90
7.2.290.0160.00616.81
7.2.260.0110.00515.15
7.2.250.0050.01215.17
7.2.240.0050.01015.27
7.2.230.0090.00715.41
7.2.220.0070.01215.32
7.2.210.0090.00515.30
7.2.200.0040.00915.30
7.2.190.0080.00815.20
7.2.180.0100.00715.19
7.2.170.0030.01015.35
7.2.160.0030.01015.16
7.2.150.0050.00817.07
7.2.140.0030.01017.07
7.2.130.0130.00617.04
7.2.120.0020.01417.11
7.2.110.0110.00616.91
7.2.100.0080.01116.95
7.2.90.0060.00717.02
7.2.80.0060.01017.19
7.2.70.0060.00717.10
7.2.60.0080.00816.93
7.2.50.0070.01116.91
7.2.40.0080.00717.17
7.2.30.0030.01317.12
7.2.20.0070.00917.10
7.2.10.0060.00917.11
7.2.00.0080.00717.61
7.1.330.0030.01116.09
7.1.320.0070.00916.00
7.1.310.0090.00616.15
7.1.300.0050.00515.84
7.1.290.0040.00615.82
7.1.280.0060.00815.98
7.1.270.0080.00615.96
7.1.260.0050.00615.98
7.1.250.0070.00915.92
7.1.240.0060.00915.89
7.1.230.0030.01016.09
7.1.220.0060.00916.01
7.1.210.0090.00416.11
7.1.200.0060.00715.95
7.1.190.0030.00915.88
7.1.180.0060.00815.88
7.1.170.0080.00515.80
7.1.160.0050.00716.10
7.1.150.0020.00916.17
7.1.140.0070.00615.97
7.1.130.0040.01116.10
7.1.120.0000.00915.95
7.1.110.0060.00816.13
7.1.100.0040.00916.63
7.1.90.0030.01315.95
7.1.80.0080.00815.98
7.1.70.0040.00916.54
7.1.60.0040.00917.12
7.1.50.0040.00916.29
7.1.40.0040.01015.99
7.1.30.0070.00816.03
7.1.20.0050.00515.96
7.1.10.0030.00715.88
7.1.00.0040.03118.16
7.0.330.0020.01215.61
7.0.320.0040.00915.63
7.0.310.0040.00815.55
7.0.300.0090.00715.43
7.0.290.0090.00315.33
7.0.280.0020.01215.71
7.0.270.0090.00115.57
7.0.260.0050.00515.69
7.0.250.0030.00815.62
7.0.240.0080.00815.66
7.0.230.0060.00715.56
7.0.220.0050.00615.61
7.0.210.0050.00915.67
7.0.200.0080.00216.10
7.0.190.0070.00415.62
7.0.180.0060.00315.61
7.0.170.0040.00915.51
7.0.160.0070.00715.53
7.0.150.0020.01115.42
7.0.140.0060.02917.69
7.0.130.0050.00915.69
7.0.120.0050.00915.74
7.0.110.0050.00715.53
7.0.100.0060.00615.57
7.0.90.0040.01115.54
7.0.80.0060.00615.51
7.0.70.0070.00815.58
7.0.60.0050.03417.02
7.0.50.0090.02316.40
7.0.40.0050.03315.88
7.0.30.0100.01915.92
7.0.20.0120.02115.88
7.0.10.0100.02615.90
7.0.00.0040.03415.81
5.6.400.0090.00314.68
5.6.390.0050.00914.54
5.6.380.0070.00914.59
5.6.370.0050.00814.14
5.6.360.0030.00814.60
5.6.350.0060.00514.66
5.6.340.0110.00114.63
5.6.330.0060.00614.64
5.6.320.0030.00614.55
5.6.310.0000.01414.51
5.6.300.0050.00714.84
5.6.290.0030.00714.46
5.6.280.0050.00614.28
5.6.270.0050.00414.55
5.6.260.0080.00514.66
5.6.250.0080.00614.47
5.6.240.0060.00614.50
5.6.230.0050.00714.53
5.6.220.0100.00614.49
5.6.210.0100.02216.59
5.6.200.0060.03315.77
5.6.190.0060.03616.52
5.6.180.0210.02616.53
5.6.170.0100.02916.53
5.6.160.0050.02916.37
5.6.150.0060.02315.67
5.6.140.0070.03115.67
5.6.130.0090.01415.87
5.6.120.0050.03616.63
5.6.110.0050.02516.67
5.6.100.0060.03116.50
5.6.90.0020.03116.78
5.6.80.0070.02716.39
5.6.70.0050.00714.48
5.6.60.0070.00614.40
5.6.50.0050.01014.52
5.6.40.0060.00714.47
5.6.30.0070.00814.31
5.6.20.0050.00614.52
5.6.10.0060.01014.58
5.6.00.0050.00814.34
5.5.380.0040.00914.26
5.5.370.0050.00914.38
5.5.360.0050.01014.38
5.5.350.0090.01316.33
5.5.340.0050.02815.66
5.5.330.0100.01416.29
5.5.320.0130.02916.42
5.5.310.0100.02916.38
5.5.300.0040.02215.61
5.5.290.0070.01715.52
5.5.280.0030.03416.52
5.5.270.0010.02316.50
5.5.260.0090.02016.39
5.5.250.0040.01816.42
5.5.240.0040.02116.42
5.5.230.0050.00614.37
5.5.220.0080.00514.46
5.5.210.0080.00114.11
5.5.200.0020.01114.20
5.5.190.0000.01314.18
5.5.180.0050.00714.20
5.5.170.0030.01214.34
5.5.160.0070.00614.36
5.5.150.0060.00614.46
5.5.140.0030.00814.34
5.5.130.0070.00514.43
5.5.120.0060.00914.29
5.5.110.0070.00714.24
5.5.100.0100.00614.45
5.5.90.0090.00714.18
5.5.80.0020.00914.24
5.5.70.0060.00814.13
5.5.60.0080.00514.17
5.5.50.0090.00514.48
5.5.40.0060.00714.29
5.5.30.0030.01014.13
5.5.20.0050.00814.40
5.5.10.0020.01414.00
5.5.00.0060.00614.12
5.4.450.0170.01914.56
5.4.440.0320.02314.51
5.4.430.0090.02014.57
5.4.420.0070.01914.53
5.4.410.0050.02414.26
5.4.400.0070.02114.22
5.4.390.0070.02014.28
5.4.380.0080.01914.20
5.4.370.0070.01914.29
5.4.360.0090.01914.20
5.4.350.0050.01412.04
5.4.340.0040.02012.04
5.4.330.0000.01012.04
5.4.320.0080.01312.20
5.4.310.0060.01512.20
5.4.300.0080.01412.20
5.4.290.0060.01812.20
5.4.280.0080.01412.16
5.4.270.0020.01812.16
5.4.260.0070.01612.16
5.4.250.0050.01712.16
5.4.240.0040.01612.16
5.4.230.0030.01912.16
5.4.220.0070.01512.16
5.4.210.0040.01712.16
5.4.200.0060.01412.16
5.4.190.0080.01412.16
5.4.180.0070.01712.16
5.4.170.0040.01812.16
5.4.160.0050.01612.16
5.4.150.0050.01612.16
5.4.140.0040.01912.05
5.4.130.0050.01712.05
5.4.120.0040.01712.04
5.4.110.0060.01412.04
5.4.100.0050.01712.04
5.4.90.0040.01812.04
5.4.80.0070.01412.04
5.4.70.0060.01512.04
5.4.60.0060.01812.03
5.4.50.0070.01612.03
5.4.40.0080.01512.03
5.4.30.0040.01512.03
5.4.20.0060.01612.03
5.4.10.0060.01612.03
5.4.00.0050.01711.86
5.3.290.0030.01912.29
5.3.280.0040.01812.26
5.3.270.0040.01612.27
5.3.260.0070.01812.27
5.3.250.0070.02012.27
5.3.240.0050.01712.27
5.3.230.0050.01512.26
5.3.220.0020.01812.26
5.3.210.0030.01912.25
5.3.200.0040.01912.25
5.3.190.0040.01712.25
5.3.180.0050.01512.25
5.3.170.0060.01712.25
5.3.160.0050.01712.25
5.3.150.0060.01812.25
5.3.140.0050.01612.25
5.3.130.0030.01912.25
5.3.120.0030.01812.25
5.3.110.0040.01712.25
5.3.100.0030.01612.08
5.3.90.0040.01712.07
5.3.80.0050.01512.06
5.3.70.0060.01512.07
5.3.60.0030.01912.06
5.3.50.0040.01912.04
5.3.40.0060.01712.04
5.3.30.0060.01612.03
5.3.20.0030.01811.96
5.3.10.0030.01711.95
5.3.00.0050.01611.94
5.2.170.0070.0289.24
5.2.160.0040.0309.24
5.2.150.0020.0349.24
5.2.140.0110.0259.23
5.2.130.0050.0299.20
5.2.120.0060.0359.20
5.2.110.0060.0289.20
5.2.100.0070.0269.20
5.2.90.0030.0349.20
5.2.80.0040.0319.20
5.2.70.0020.0339.19
5.2.60.0030.0339.14
5.2.50.0070.0289.11
5.2.40.0050.0299.10
5.2.30.0050.0309.07
5.2.20.0050.0299.05
5.2.10.0060.0348.94
5.2.00.0090.0248.82
5.1.60.0040.0248.10
5.1.50.0060.0238.09
5.1.40.0070.0228.07
5.1.30.0040.0278.43
5.1.20.0040.0288.45
5.1.10.0030.0288.17
5.1.00.0070.0258.17
5.0.50.0040.0216.65
5.0.40.0040.0206.51
5.0.30.0020.0346.32
5.0.20.0040.0256.29
5.0.10.0020.0216.27
5.0.00.0050.0286.26
4.4.90.0010.0184.78
4.4.80.0040.0144.75
4.4.70.0030.0154.75
4.4.60.0030.0154.75
4.4.50.0010.0174.77
4.4.40.0020.0264.71
4.4.30.0060.0134.76
4.4.20.0040.0144.85
4.4.10.0030.0174.85
4.4.00.0030.0274.76
4.3.110.0030.0164.67
4.3.100.0010.0214.66
4.3.90.0040.0134.63
4.3.80.0020.0254.58
4.3.70.0010.0164.63
4.3.60.0000.0174.63
4.3.50.0020.0164.63
4.3.40.0010.0264.54
4.3.30.0020.0163.30
4.3.20.0030.0153.28
4.3.10.0040.0143.24
4.3.00.0170.0207.17

preferences:
43.92 ms | 401 KiB | 5 Q