3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = <<<SOURCEND This is a test {% block hello %} This is a test This is a {{ \$test }} {% end block %} {{ block('hello') }} {% for \$post in \$posts %} {% end %} SOURCEND; function microtwig_compile($source){ function microtwig_parsecmd($cmd){ static $stack = array(); $fragments = preg_split('/\s+/',$cmd); $cmd = array_shift($fragments); switch($cmd){ case 'block': return 'function block_'.$fragments[0].'(){'; break; case 'if': $stack[] = 'if'; return 'if('.$fragments[2].' as '.$fragments[0].'):'; break; case 'for': $stack[] = 'foreach'; return 'foreach('.$fragments[2].' as '.$fragments[0].'):'; break; case 'end': switch(isset($fragments[0])?$fragments[0]:''){ case 'block': return '}'; break; default: switch($peek = array_pop($stack)){ case 'if': return 'endif;'; break; case 'foreach': return 'endforeach;'; break; } break; } break; default: break; } } $cnt=0; $fragments = array(); $source = str_replace(array('{{','}}'),array('<?=','?>'),$source); foreach(explode('{%',$source) as $tmp) { foreach(explode('%}',$tmp) as $item) { $fragments[] = $cnt++%2?'<?php '.microtwig_parsecmd(trim($item)).'?>':$item; } } return implode('',$fragments); } echo microtwig_compile($source);

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.0130.00718.43
8.3.50.0140.00622.03
8.3.40.0090.00619.09
8.3.30.0090.00619.26
8.3.20.0050.00220.13
8.3.10.0070.00021.95
8.3.00.0060.00322.52
8.2.180.0120.00616.88
8.2.170.0090.00622.96
8.2.160.0070.00720.83
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0070.00719.61
8.2.110.0050.00522.26
8.2.100.0060.00619.57
8.2.90.0080.00019.17
8.2.80.0040.00418.03
8.2.70.0000.00817.75
8.2.60.0000.01017.93
8.2.50.0000.00818.07
8.2.40.0040.00418.34
8.2.30.0000.00718.16
8.2.20.0000.00717.96
8.2.10.0040.00419.73
8.2.00.0000.00717.98
8.1.280.0110.00425.92
8.1.270.0000.00822.22
8.1.260.0080.00026.35
8.1.250.0090.00028.09
8.1.240.0040.00423.80
8.1.230.0040.00818.90
8.1.220.0040.00417.90
8.1.210.0040.00418.77
8.1.200.0000.01017.48
8.1.190.0030.00617.66
8.1.180.0040.00418.85
8.1.170.0000.00818.83
8.1.160.0080.00022.07
8.1.150.0050.00218.81
8.1.140.0070.00017.55
8.1.130.0030.00317.92
8.1.120.0000.00717.70
8.1.110.0050.00217.64
8.1.100.0000.00717.68
8.1.90.0030.00517.55
8.1.80.0000.00817.68
8.1.70.0030.00317.54
8.1.60.0080.00017.76
8.1.50.0040.00417.69
8.1.40.0040.00417.75
8.1.30.0040.00417.79
8.1.20.0030.00617.74
8.1.10.0040.00417.75
8.1.00.0050.00317.55
8.0.300.0040.00418.77
8.0.290.0000.00716.93
8.0.280.0040.00418.41
8.0.270.0090.00017.16
8.0.260.0080.00317.13
8.0.250.0000.00717.27
8.0.240.0030.00517.17
8.0.230.0040.00417.27
8.0.220.0030.00516.99
8.0.210.0040.00417.08
8.0.200.0030.00317.10
8.0.190.0030.00617.18
8.0.180.0070.00017.21
8.0.170.0000.00717.16
8.0.160.0000.00717.07
8.0.150.0000.01017.02
8.0.140.0000.00817.09
8.0.130.0050.00013.60
8.0.120.0040.00417.09
8.0.110.0040.00417.04
8.0.100.0070.00017.05
8.0.90.0040.00417.01
8.0.80.0140.00717.18
8.0.70.0000.00817.20
8.0.60.0030.00517.16
8.0.50.0030.00517.00
8.0.30.0090.01217.33
8.0.20.0130.00717.40
8.0.10.0040.00417.06
8.0.00.0120.00717.00
7.4.330.0000.00515.00
7.4.320.0000.00716.84
7.4.300.0000.00616.80
7.4.290.0000.00816.62
7.4.280.0080.00016.85
7.4.270.0030.00316.66
7.4.260.0030.00316.81
7.4.250.0040.00416.73
7.4.240.0050.00316.72
7.4.230.0040.00416.86
7.4.220.0040.01816.81
7.4.210.0110.00716.76
7.4.200.0000.00716.75
7.4.190.0030.00316.92
7.4.160.0110.00516.54
7.4.150.0070.01017.40
7.4.140.0060.01217.86
7.4.130.0100.00916.71
7.4.120.0090.00916.93
7.4.110.0110.00716.68
7.4.100.0160.00616.92
7.4.90.0060.01216.72
7.4.80.0090.00919.39
7.4.70.0110.00516.81
7.4.60.0060.00916.79
7.4.50.0030.00616.64
7.4.40.0060.00922.77
7.4.30.0140.00316.82
7.4.00.0070.01015.41
7.3.330.0000.00513.46
7.3.320.0050.00013.58
7.3.310.0070.00016.62
7.3.300.0000.00716.59
7.3.290.0050.01016.52
7.3.280.0080.00816.48
7.3.270.0070.01017.40
7.3.260.0170.00016.61
7.3.250.0110.01016.69
7.3.240.0070.01116.74
7.3.230.0070.01116.72
7.3.210.0040.01216.68
7.3.200.0140.01319.39
7.3.190.0100.00716.49
7.3.180.0100.00616.41
7.3.170.0030.01416.55
7.3.160.0060.01216.66
7.3.120.0060.00916.90
7.3.110.0060.01116.90
7.3.100.0110.00316.90
7.3.90.0070.00416.90
7.3.80.0040.01116.90
7.3.70.0090.00616.90
7.3.60.0100.00716.90
7.3.50.0090.00316.90
7.3.40.0090.00916.90
7.3.30.0060.00616.90
7.3.20.0030.00616.90
7.3.10.0030.01416.90
7.3.00.0040.01416.99
7.2.330.0140.00316.78
7.2.320.0110.00716.89
7.2.310.0070.01016.87
7.2.300.0100.01016.80
7.2.290.0100.01316.88
7.2.240.0030.01216.90
7.2.230.0110.00416.90
7.2.220.0100.00616.90
7.2.210.0060.00916.90
7.2.200.0040.01116.90
7.2.190.0100.00316.90
7.2.180.0060.01216.90
7.2.170.0110.00416.90
7.2.160.0090.00916.90
7.2.150.0030.00916.90
7.2.140.0070.00716.93
7.2.130.0040.01217.00
7.2.120.0040.01117.00
7.2.110.0040.00817.11
7.2.100.0100.00717.02
7.2.90.0070.01117.12
7.2.80.0110.00417.09
7.2.70.0040.01417.02
7.2.60.0030.01016.97
7.2.50.0090.00917.10
7.2.40.0030.01217.19
7.2.30.0100.00716.90
7.2.20.0000.01417.08
7.2.10.0100.00717.12
7.2.00.0050.01218.50
7.1.330.0040.01216.90
7.1.320.0030.01216.90
7.1.310.0000.01516.90
7.1.300.0030.01416.90
7.1.290.0100.00616.90
7.1.280.0130.00316.90
7.1.270.0130.00316.90
7.1.260.0100.00716.90
7.1.250.0030.01016.90
7.1.100.0030.01018.31
7.1.70.0000.00817.14
7.1.60.0030.02119.82
7.1.50.0210.01835.16
7.1.00.0000.08022.55
7.0.200.0160.00316.82
7.0.140.0100.06722.08
7.0.60.0070.03719.94
7.0.50.0000.07317.88
7.0.40.0070.05720.04
7.0.30.0270.04020.10
7.0.20.0170.05720.31
7.0.10.0330.07720.12
7.0.00.0100.08720.16
5.6.280.0030.07321.17
5.6.210.0100.07720.77
5.6.200.0170.07318.14
5.6.190.0070.04320.59
5.6.180.3670.03720.52
5.6.170.0130.06020.51
5.6.160.0100.08020.46
5.6.150.0130.04318.19
5.6.140.0030.04318.24
5.6.130.0130.07718.16
5.6.120.0130.07021.05
5.6.110.0170.08321.00
5.6.100.0030.05721.04
5.6.90.0000.09321.00
5.6.80.0170.06020.43
5.6.70.0170.04020.39
5.5.350.0100.05720.51
5.5.340.0100.07317.97
5.5.330.0070.03720.57
5.5.320.0170.04020.19
5.5.310.0270.08320.38
5.5.300.0000.04318.08
5.5.290.0130.07718.09
5.5.280.0100.06721.00
5.5.270.0000.04720.68
5.5.260.0000.07320.88
5.5.250.0130.07320.63
5.5.240.0170.07020.30
5.4.450.0630.05319.20
5.4.440.0470.06319.39
5.4.430.0270.06319.43
5.4.420.0100.05719.36
5.4.410.0030.06019.27
5.4.400.0870.00018.72
5.4.390.0670.00018.79
5.4.380.0230.05718.80
5.4.370.0400.04718.76
5.4.360.0330.05018.62
5.4.350.0270.05018.74
5.4.340.0300.05318.55
5.4.320.0090.03812.52
5.4.310.0070.04412.52
5.4.300.0060.04212.52
5.4.290.0060.03612.52
5.4.280.0050.04312.42
5.4.270.0070.03512.42
5.4.260.0100.05018.95
5.4.250.0100.05018.77
5.4.240.0070.05318.91
5.4.230.0170.05018.77
5.4.220.0130.05019.03
5.4.210.0030.05718.75
5.4.200.0000.05719.03
5.4.190.0100.04718.96
5.4.180.0100.04719.00
5.4.170.0100.07018.79
5.4.160.0070.05318.82
5.4.150.0100.05019.09
5.4.140.0070.05016.59
5.4.130.0070.05016.48
5.4.120.0100.04316.42
5.4.110.0070.05316.44
5.4.100.0170.05716.71
5.4.90.0030.05316.43
5.4.80.0030.05016.66
5.4.70.0070.06316.61
5.4.60.0170.06316.36
5.4.50.0130.04316.46
5.4.40.0100.04316.55
5.4.30.0070.05016.54
5.4.20.0130.04016.52
5.4.10.0100.07016.33
5.4.00.0070.04715.98
5.3.290.0050.03912.80
5.3.280.0200.03714.71
5.3.270.0130.04314.86
5.3.260.0170.04314.79
5.3.250.0030.06014.64
5.3.240.0100.04714.80
5.3.230.0030.05314.71
5.3.220.0070.05014.60
5.3.210.0000.05714.57
5.3.200.0070.07314.80
5.3.190.0030.05314.49
5.3.180.0030.05714.56
5.3.170.0100.05014.72
5.3.160.0070.05014.57
5.3.150.0070.05714.64
5.3.140.0030.05014.55
5.3.130.0070.05314.59
5.3.120.0100.05014.65
5.3.110.0100.04714.59
5.3.100.0000.05314.28
5.3.90.0070.05014.18
5.3.80.0100.05014.12
5.3.70.0030.05314.22
5.3.60.0030.05013.93
5.3.50.0130.04014.06
5.3.40.0000.05714.15
5.3.30.0100.05313.93
5.3.20.0130.04013.79
5.3.10.0030.07713.73
5.3.00.0030.05013.63
5.2.170.0000.04711.16
5.2.160.0130.03011.26
5.2.150.0100.03711.13
5.2.140.0000.04311.25
5.2.130.0070.03711.31
5.2.120.0030.03711.04
5.2.110.0000.04311.20
5.2.100.0030.04711.30
5.2.90.0070.05011.20
5.2.80.0070.04711.10
5.2.70.0000.04311.19
5.2.60.0070.04311.16
5.2.50.0030.04011.28
5.2.40.0030.04011.21
5.2.30.0100.03711.07
5.2.20.0030.04011.05
5.2.10.0130.03010.97
5.2.00.0130.04010.91
5.1.60.0000.03710.11
5.1.50.0030.03310.03
5.1.40.0030.03310.10
5.1.30.0100.03010.43
5.1.20.0000.04010.37
5.1.10.0130.02710.34
5.1.00.0070.03710.07
5.0.50.0030.0378.68
5.0.40.0070.0338.71
5.0.30.0000.0438.31
5.0.20.0000.0308.09
5.0.10.0000.0338.06
5.0.00.0030.0408.13
4.4.90.0070.0207.02
4.4.80.0030.0307.02
4.4.70.0000.0277.02
4.4.60.0000.0237.02
4.4.50.0000.0237.02
4.4.40.0000.0377.02
4.4.30.0030.0237.02
4.4.20.0000.0237.02
4.4.10.0030.0207.02
4.4.00.0030.0307.02
4.3.110.0000.0307.02
4.3.100.0000.0237.02
4.3.90.0030.0237.02
4.3.80.0000.0337.02
4.3.70.0170.0077.02
4.3.60.0030.0237.02
4.3.50.0030.0207.02
4.3.40.0070.0277.02
4.3.30.0070.0207.02
4.3.20.0030.0277.02
4.3.10.0000.0307.02
4.3.00.0200.0177.32

preferences:
43.47 ms | 401 KiB | 5 Q