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 = ( is_file($this->tpl) )?file_get_contents($this->tpl) : $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!'); 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.0170.00018.93
8.3.50.0150.00022.23
8.3.40.0040.01819.04
8.3.30.0040.01119.18
8.3.20.0040.00420.34
8.3.10.0080.00021.96
8.3.00.0030.00618.13
8.2.180.0000.02116.88
8.2.170.0040.01122.96
8.2.160.0090.00620.38
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0080.00021.15
8.2.110.0070.00422.38
8.2.100.0090.00318.03
8.2.90.0080.00019.20
8.2.80.0030.00717.97
8.2.70.0000.00917.88
8.2.60.0070.00318.04
8.2.50.0040.00718.07
8.2.40.0060.00318.16
8.2.30.0030.00518.37
8.2.20.0050.00317.84
8.2.10.0000.00817.98
8.2.00.0050.00319.68
8.1.280.0100.00725.92
8.1.270.0030.00623.87
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0030.00723.89
8.1.230.0080.00419.08
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0000.01017.38
8.1.190.0090.00017.38
8.1.180.0030.00618.10
8.1.170.0000.00818.63
8.1.160.0050.00222.05
8.1.150.0000.00718.84
8.1.140.0000.00717.61
8.1.130.0030.00317.86
8.1.120.0030.00317.54
8.1.110.0070.00017.66
8.1.100.0040.00417.66
8.1.90.0030.00517.53
8.1.80.0080.00017.66
8.1.70.0070.00017.50
8.1.60.0040.00417.77
8.1.50.0030.00617.64
8.1.40.0080.00017.56
8.1.30.0040.00417.74
8.1.20.0030.00517.84
8.1.10.0040.00417.75
8.1.00.0050.00217.66
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0050.00318.59
8.0.270.0030.00317.41
8.0.260.0030.00317.29
8.0.250.0070.00017.31
8.0.240.0040.00417.28
8.0.230.0070.00017.21
8.0.220.0000.00717.09
8.0.210.0040.00417.07
8.0.200.0030.00317.30
8.0.190.0000.00717.25
8.0.180.0000.00717.21
8.0.170.0080.00017.26
8.0.160.0040.00417.29
8.0.150.0040.00417.14
8.0.140.0030.00717.04
8.0.130.0000.00513.70
8.0.120.0000.00817.13
8.0.110.0020.00517.08
8.0.100.0040.00417.02
8.0.90.0040.00417.25
8.0.80.0120.00317.17
8.0.70.0060.00317.14
8.0.60.0070.00017.19
8.0.50.0050.00317.23
8.0.30.0130.00917.27
8.0.20.0120.00717.40
8.0.10.0000.00817.27
8.0.00.0080.01017.04
7.4.330.0030.00315.11
7.4.320.0040.00416.76
7.4.300.0030.00316.82
7.4.290.0040.00816.77
7.4.280.0110.00016.83
7.4.270.0040.00416.77
7.4.260.0030.00616.88
7.4.250.0050.00316.82
7.4.240.0030.00316.78
7.4.230.0000.00716.66
7.4.220.0060.01316.88
7.4.210.0070.01016.79
7.4.200.0000.00716.64
7.4.160.0060.00916.75
7.4.150.0030.01717.40
7.4.140.0070.01417.86
7.4.130.0100.00816.77
7.4.120.0110.00616.86
7.4.110.0100.01316.87
7.4.100.0170.00016.72
7.4.90.0120.00616.77
7.4.80.0140.00719.39
7.4.70.0080.00816.85
7.4.60.0070.01016.95
7.4.50.0060.00316.66
7.4.40.0100.00716.61
7.4.30.0040.01216.78
7.4.00.0030.00715.16
7.3.330.0030.00313.45
7.3.320.0020.00213.45
7.3.310.0000.00616.55
7.3.300.0030.00316.52
7.3.290.0100.01016.54
7.3.280.0100.00716.56
7.3.270.0150.00317.40
7.3.260.0160.00316.84
7.3.250.0150.00516.81
7.3.240.0090.00916.55
7.3.230.0090.00916.81
7.3.210.0060.01216.73
7.3.200.0090.00919.39
7.3.190.0060.01616.60
7.3.180.0160.00016.59
7.3.170.0030.01316.56
7.3.160.0120.00416.64
7.3.120.0040.01215.05
7.2.330.0060.01216.92
7.2.320.0090.00917.03
7.2.310.0100.00716.91
7.2.300.0030.01416.82
7.2.290.0110.01116.93
7.2.00.0000.01519.68
7.1.100.0060.00918.45
7.1.70.0030.00617.58
7.1.60.0110.00719.25
7.1.50.0100.01017.26
7.1.00.0070.07322.29
7.0.200.0030.00517.04
7.0.140.0130.06322.01
7.0.60.0070.04319.88
7.0.50.0070.08017.86
7.0.40.0100.04020.26
7.0.30.0400.07320.14
7.0.20.0300.08020.13
7.0.10.0030.08720.24
7.0.00.0100.08720.25
5.6.280.0030.07321.11
5.6.210.0170.07020.75
5.6.200.0000.05018.18
5.6.190.0070.09020.61
5.6.180.0230.08020.63
5.6.170.0170.04720.71
5.6.160.0130.07720.55
5.6.150.0000.05718.27
5.6.140.0100.03718.17
5.6.130.0130.04718.14
5.6.120.0030.04321.13
5.6.110.0100.08020.99
5.6.100.0000.06021.01
5.6.90.0100.08021.02
5.6.80.0130.07020.43
5.5.350.0230.03020.41
5.5.340.0030.07317.98
5.5.330.0030.09020.40
5.5.320.0300.06320.36
5.5.310.0370.06720.27
5.5.300.0000.04317.93
5.5.290.0100.05018.06
5.5.280.0130.07720.85
5.5.270.0070.05320.77
5.5.260.0100.06320.77
5.5.250.0000.04320.59
5.5.240.0030.07320.36
5.4.450.0600.06719.56
5.4.440.0270.04719.47
5.4.430.0270.04319.16
5.4.420.0200.05019.46
5.4.410.0100.05318.73
5.4.400.0400.06718.72
5.4.390.0500.07018.48
5.4.380.0170.05718.59
5.4.370.0100.04018.59
5.4.360.0100.05018.71
5.4.350.0060.03912.02
5.4.340.0030.04312.02
5.4.320.0050.03712.51
5.4.310.0120.03312.50
5.4.300.0060.03812.51
5.4.290.0080.04912.51
5.4.280.0070.03512.40
5.4.270.0080.04412.40
5.4.260.0080.03812.40
5.4.250.0070.04212.40
5.4.240.0070.04012.41
5.4.230.0060.04712.39
5.4.220.0030.04312.40
5.4.210.0080.04212.39
5.4.200.0050.03812.39
5.4.190.0090.03312.39
5.4.180.0050.03712.39
5.4.170.0070.03512.40
5.4.160.0060.03712.40
5.4.150.0050.03512.39
5.4.140.0110.03812.08
5.4.130.0070.03512.06
5.4.120.0050.03612.03
5.4.110.0060.03612.02
5.4.100.0060.03612.02
5.4.90.0040.03812.02
5.4.80.0050.03812.02
5.4.70.0050.03612.02
5.4.60.0070.03412.02
5.4.50.0090.03912.01
5.4.40.0050.03612.00
5.4.30.0070.03512.00
5.4.20.0060.03912.00
5.4.10.0090.03211.99
5.4.00.0070.03711.48
5.3.290.0050.04012.80
5.3.280.0100.03412.71
5.3.270.0080.03712.72
5.3.260.0070.03712.71
5.3.250.0030.03912.72
5.3.240.0060.03612.72
5.3.230.0080.03712.71
5.3.220.0080.03612.68
5.3.210.0070.03912.68
5.3.200.0070.03612.68
5.3.190.0090.03512.68
5.3.180.0060.03812.68
5.3.170.0060.03812.66
5.3.160.0030.04012.67
5.3.150.0060.03812.67
5.3.140.0070.03612.66
5.3.130.0090.04412.65
5.3.120.0040.04112.66
5.3.110.0040.04012.66
5.3.100.0080.03512.13
5.3.90.0040.03912.12
5.3.80.0070.03512.11
5.3.70.0050.03712.11
5.3.60.0040.03812.10
5.3.50.0070.03512.05
5.3.40.0080.03512.04
5.3.30.0060.03612.00
5.3.20.0060.03511.78
5.3.10.0060.03511.75
5.3.00.0080.04111.74
5.2.170.0040.0319.24
5.2.160.0050.0299.24
5.2.150.0020.0339.24
5.2.140.0080.0279.23
5.2.130.0070.0339.20
5.2.120.0070.0269.19
5.2.110.0060.0299.20
5.2.100.0070.0279.20
5.2.90.0070.0279.20
5.2.80.0060.0309.19
5.2.70.0050.0309.19
5.2.60.0040.0309.14
5.2.50.0060.0289.12
5.2.40.0040.0309.09
5.2.30.0050.0309.07
5.2.20.0060.0279.06
5.2.10.0070.0258.95
5.2.00.0050.0288.81
5.1.60.0060.0228.09
5.1.50.0050.0248.09
5.1.40.0040.0248.07
5.1.30.0030.0288.42
5.1.20.0080.0248.45
5.1.10.0050.0258.17
5.1.00.0030.0278.17
5.0.50.0040.0216.65
5.0.40.0010.0226.51
5.0.30.0030.0326.32
5.0.20.0040.0196.29
5.0.10.0030.0206.27
5.0.00.0050.0296.26
4.4.90.0030.0154.78
4.4.80.0020.0164.76
4.4.70.0020.0164.76
4.4.60.0030.0164.75
4.4.50.0030.0214.77
4.4.40.0040.0274.71
4.4.30.0030.0154.76
4.4.20.0010.0174.85
4.4.10.0010.0174.85
4.4.00.0040.0244.76
4.3.110.0020.0164.67
4.3.100.0020.0164.66
4.3.90.0030.0154.64
4.3.80.0020.0254.58
4.3.70.0030.0144.63
4.3.60.0020.0154.63
4.3.50.0030.0154.63
4.3.40.0050.0224.54
4.3.30.0010.0213.30
4.3.20.0010.0173.28
4.3.10.0000.0183.24
4.3.00.0100.0277.21

preferences:
37.29 ms | 401 KiB | 5 Q