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.0100.01018.83
8.3.50.0080.01122.05
8.3.40.0120.00319.13
8.3.30.0120.00319.22
8.3.20.0080.00020.29
8.3.10.0040.00422.13
8.3.00.0090.00022.34
8.2.180.0080.01116.75
8.2.170.0080.00822.96
8.2.160.0100.00321.07
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0090.00026.16
8.2.120.0160.00019.61
8.2.110.0030.00622.27
8.2.100.0040.00819.76
8.2.90.0000.00819.35
8.2.80.0040.00418.03
8.2.70.0060.00317.75
8.2.60.0060.00317.93
8.2.50.0030.00518.07
8.2.40.0080.00018.16
8.2.30.0000.00718.25
8.2.20.0000.00817.88
8.2.10.0000.00819.80
8.2.00.0000.00818.02
8.1.280.0070.00725.92
8.1.270.0040.00422.23
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0030.00623.96
8.1.230.0040.00719.14
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0060.00317.54
8.1.180.0000.00818.58
8.1.170.0000.00818.89
8.1.160.0040.00422.08
8.1.150.0000.00718.89
8.1.140.0030.00517.51
8.1.130.0040.00217.90
8.1.120.0040.00417.70
8.1.110.0060.00317.66
8.1.100.0000.00717.71
8.1.90.0030.00617.57
8.1.80.0000.00717.55
8.1.70.0050.00217.61
8.1.60.0050.00317.68
8.1.50.0000.00817.77
8.1.40.0040.00417.70
8.1.30.0090.00017.75
8.1.20.0040.00417.70
8.1.10.0030.00517.79
8.1.00.0060.00317.55
8.0.300.0000.00718.77
8.0.290.0000.00717.05
8.0.280.0030.00618.49
8.0.270.0000.00817.33
8.0.260.0040.00417.03
8.0.250.0000.00817.13
8.0.240.0070.00017.09
8.0.230.0030.00317.17
8.0.220.0040.00417.12
8.0.210.0000.00717.13
8.0.200.0030.00317.12
8.0.190.0060.00617.12
8.0.180.0080.00017.13
8.0.170.0000.00717.03
8.0.160.0040.00417.21
8.0.150.0070.00017.17
8.0.140.0020.00517.06
8.0.130.0060.00013.56
8.0.120.0040.00417.12
8.0.110.0050.00317.20
8.0.100.0030.00616.98
8.0.90.0060.00317.27
8.0.80.0150.00317.07
8.0.70.0000.00717.07
8.0.60.0050.00317.09
8.0.50.0000.00816.96
8.0.30.0070.01417.30
8.0.20.0100.01117.49
8.0.10.0040.00417.10
8.0.00.0080.01217.09
7.4.330.0030.00315.00
7.4.320.0040.00416.67
7.4.300.0000.00616.78
7.4.290.0000.00716.83
7.4.280.0070.00016.78
7.4.270.0030.00516.86
7.4.260.0000.00716.68
7.4.250.0080.00016.71
7.4.240.0020.00516.79
7.4.230.0000.00716.76
7.4.220.0160.00916.85
7.4.210.0110.00616.86
7.4.200.0080.00016.92
7.4.190.0040.00416.99
7.4.160.0070.01016.78
7.4.150.0100.01017.40
7.4.140.0140.00617.86
7.4.130.0100.00916.88
7.4.120.0120.00616.80
7.4.110.0110.01116.85
7.4.100.0150.00916.84
7.4.90.0140.01116.64
7.4.80.0090.01519.39
7.4.70.0030.01416.97
7.4.60.0100.00716.75
7.4.50.0030.00316.89
7.4.40.0090.00622.77
7.4.30.0060.00916.77
7.4.00.0090.00815.20
7.3.330.0030.00313.59
7.3.320.0000.00513.56
7.3.310.0000.00716.63
7.3.300.0000.00716.64
7.3.290.0030.01216.63
7.3.280.0080.00716.61
7.3.270.0140.00317.40
7.3.260.0130.00416.67
7.3.250.0120.00816.59
7.3.240.0200.00316.63
7.3.230.0180.00316.60
7.3.210.0090.00916.71
7.3.200.0110.00619.39
7.3.190.0090.01216.53
7.3.180.0080.00816.74
7.3.170.0060.01016.69
7.3.160.0100.00616.68
7.3.120.0110.00615.10
7.3.110.0050.01315.06
7.3.100.0100.00714.88
7.3.90.0020.01015.19
7.3.80.0060.00315.11
7.3.70.0090.00514.90
7.3.60.0040.00714.99
7.3.50.0020.01215.14
7.3.40.0050.00615.13
7.3.30.0080.00615.18
7.3.20.0050.00717.02
7.3.10.0060.00816.68
7.3.00.0070.00717.02
7.2.330.0000.01816.79
7.2.320.0060.01217.00
7.2.310.0080.01516.80
7.2.300.0060.01516.84
7.2.290.0070.01417.05
7.2.250.0030.01515.11
7.2.240.0070.01015.53
7.2.230.0100.00615.18
7.2.220.0070.00715.43
7.2.210.0040.00715.27
7.2.200.0040.01215.30
7.2.190.0070.00815.45
7.2.180.0070.00415.04
7.2.170.0080.00615.19
7.2.160.0040.01115.34
7.2.150.0030.00917.06
7.2.140.0030.01017.23
7.2.130.0100.00017.13
7.2.120.0070.01116.88
7.2.110.0120.00617.25
7.2.100.0000.01317.18
7.2.90.0000.01317.18
7.2.80.0090.00317.21
7.2.70.0030.00617.19
7.2.60.0040.01117.06
7.2.50.0000.00917.10
7.2.40.0090.00917.08
7.2.30.0030.01217.22
7.2.20.0070.00317.15
7.2.10.0030.00717.09
7.2.00.0020.01118.23
7.1.330.0030.01116.16
7.1.320.0050.00915.87
7.1.310.0080.00415.89
7.1.300.0050.00916.13
7.1.290.0030.00916.13
7.1.280.0030.01016.04
7.1.270.0070.00815.92
7.1.260.0030.01015.78
7.1.250.0030.00615.82
7.1.240.0090.00615.99
7.1.230.0030.00716.02
7.1.220.0100.00016.12
7.1.210.0080.00815.82
7.1.200.0050.00715.81
7.1.190.0030.01015.76
7.1.180.0110.00416.09
7.1.170.0070.00716.05
7.1.160.0000.00915.71
7.1.150.0080.00615.91
7.1.140.0030.00915.95
7.1.130.0060.00316.16
7.1.120.0030.00616.19
7.1.110.0030.01116.14
7.1.100.0030.01016.96
7.1.90.0110.00315.95
7.1.80.0030.00915.98
7.1.70.0070.00316.69
7.1.60.0080.01217.90
7.1.50.0170.01025.42
7.1.40.0100.00315.65
7.1.30.0000.01316.00
7.1.20.0070.00715.78
7.1.10.0100.00316.10
7.1.00.0020.04519.33
7.0.330.0060.00615.67
7.0.320.0030.00615.78
7.0.310.0050.00515.41
7.0.300.0070.00715.77
7.0.290.0040.00715.57
7.0.280.0030.00715.67
7.0.270.0060.00615.51
7.0.260.0070.00315.61
7.0.250.0000.01115.47
7.0.240.0060.00615.73
7.0.230.0060.00615.85
7.0.220.0070.00315.75
7.0.210.0070.00715.71
7.0.200.0100.00316.34
7.0.190.0030.00615.61
7.0.180.0030.00915.71
7.0.170.0080.00415.66
7.0.160.0030.00715.59
7.0.150.0070.00715.65
7.0.140.0040.03718.64
7.0.130.0070.00715.61
7.0.120.0100.00315.40
7.0.110.0070.00715.45
7.0.100.0040.00815.81
7.0.90.0120.00315.64
7.0.80.0060.00315.77
7.0.70.0070.00315.78
7.0.60.0090.04317.85
7.0.50.0050.02516.84
7.0.40.0100.03717.10
7.0.30.0200.04216.98
7.0.20.0200.02516.77
7.0.10.0120.02316.99
7.0.00.0070.02516.81
5.6.400.0110.00414.38
5.6.390.0070.00714.91
5.6.380.0030.00614.61
5.6.370.0030.01015.00
5.6.360.0030.00514.60
5.6.350.0030.01314.34
5.6.340.0060.00614.24
5.6.330.0060.00914.57
5.6.320.0040.01114.54
5.6.310.0100.00614.54
5.6.300.0000.01314.84
5.6.290.0000.00914.66
5.6.280.0050.04117.67
5.6.270.0000.01414.68
5.6.260.0030.00914.73
5.6.250.0070.00714.32
5.6.240.0070.00714.73
5.6.230.0000.01514.45
5.6.220.0000.01214.71
5.6.210.0030.04817.51
5.6.200.0050.02716.51
5.6.190.0040.03017.49
5.6.180.1600.02517.51
5.6.170.0150.03117.53
5.6.160.0070.04417.55
5.6.150.0090.04316.47
5.6.140.0040.04816.38
5.6.130.0080.03016.39
5.6.120.0060.04717.83
5.6.110.0030.04517.72
5.6.100.0070.03917.80
5.6.90.0080.04317.84
5.6.80.0070.04017.55
5.6.70.0180.04017.37
5.6.60.0100.00314.63
5.6.50.0030.01014.62
5.6.40.0130.00314.50
5.6.30.0030.01014.49
5.6.20.0080.00814.51
5.6.10.0040.00414.55
5.6.00.0070.00414.73
5.5.380.0080.00514.68
5.5.370.0030.01314.69
5.5.360.0040.00414.43
5.5.350.0030.02117.48
5.5.340.0070.03816.25
5.5.330.0040.03417.46
5.5.320.0150.02817.45
5.5.310.0150.03917.38
5.5.300.0050.04216.27
5.5.290.0100.03816.27
5.5.280.0040.02617.62
5.5.270.0110.04117.63
5.5.260.0050.04017.59
5.5.250.0080.04317.58
5.5.240.0070.04217.37
5.5.230.0070.00714.47
5.5.220.0080.00414.18
5.5.210.0060.00614.46
5.5.200.0040.00414.48
5.5.190.0030.00914.42
5.5.180.0040.01114.64
5.5.170.0050.00514.44
5.5.160.0070.00414.55
5.5.150.0060.00614.61
5.5.140.0000.01214.51
5.5.130.0000.01414.55
5.5.120.0030.01014.43
5.5.110.0090.00314.64
5.5.100.0040.00814.50
5.5.90.0060.00614.37
5.5.80.0040.01114.69
5.5.70.0110.00414.34
5.5.60.0080.00814.39
5.5.50.0120.00314.62
5.5.40.0060.00914.54
5.5.30.0060.00914.56
5.5.20.0120.00314.50
5.5.10.0000.01414.45
5.5.00.0110.00314.46
5.4.450.0220.02516.22
5.4.440.0280.03716.26
5.4.430.0120.02916.26
5.4.420.0070.02816.36
5.4.410.0300.02916.10
5.4.400.0430.00515.89
5.4.390.0410.00415.96
5.4.380.0180.02615.97
5.4.370.0510.02415.87
5.4.360.0220.02715.88
5.4.350.0250.03315.92
5.4.340.0200.02615.93
5.4.330.0000.00613.13
5.4.320.0080.02012.82
5.4.310.0040.02412.82
5.4.300.0050.02212.83
5.4.290.0040.02412.83
5.4.280.0050.01812.77
5.4.270.0050.01912.77
5.4.260.0030.03616.08
5.4.250.0030.02915.89
5.4.240.0060.02816.11
5.4.230.0030.03415.97
5.4.220.0040.03415.95
5.4.210.0030.03916.06
5.4.200.0060.03016.05
5.4.190.0050.03116.04
5.4.180.0100.03615.96
5.4.170.0050.03216.07
5.4.160.0070.02815.96
5.4.150.0070.03316.05
5.4.140.0050.03014.78
5.4.130.0050.02914.86
5.4.120.0100.03114.80
5.4.110.0020.03514.88
5.4.100.0070.03714.80
5.4.90.0110.02414.79
5.4.80.0080.03014.83
5.4.70.0030.03214.78
5.4.60.0070.02914.83
5.4.50.0150.03214.82
5.4.40.0090.02614.84
5.4.30.0050.02714.77
5.4.20.0070.02314.75
5.4.10.0070.03214.72
5.4.00.0070.03014.53
5.3.290.0070.02212.96
5.3.280.0050.03013.86
5.3.270.0030.03013.87
5.3.260.0030.04013.97
5.3.250.0090.02313.95
5.3.240.0050.02713.91
5.3.230.0070.03013.88
5.3.220.0040.03013.86
5.3.210.0080.02913.89
5.3.200.0080.03513.86
5.3.190.0050.02713.85
5.3.180.0060.03313.90
5.3.170.0100.02813.90
5.3.160.0100.03813.89
5.3.150.0040.03113.95
5.3.140.0050.03913.81
5.3.130.0030.03113.85
5.3.120.0020.03913.84
5.3.110.0140.03013.76
5.3.100.0080.03113.64
5.3.90.0050.03713.66
5.3.80.0070.02513.63
5.3.70.0080.02413.64
5.3.60.0090.03113.66
5.3.50.0050.03613.54
5.3.40.0050.02513.54
5.3.30.0080.02513.54
5.3.20.0030.02713.41
5.3.10.0060.02413.51
5.3.00.0070.02713.31
5.2.170.0000.04311.15
5.2.160.0070.03711.29
5.2.150.0030.04311.05
5.2.140.0030.04011.23
5.2.130.0000.05011.02
5.2.120.0000.04311.10
5.2.110.0030.05011.25
5.2.100.0070.03711.01
5.2.90.0000.04310.86
5.2.80.0070.04010.85
5.2.70.0130.04010.98
5.2.60.0030.04010.99
5.2.50.0030.05010.91
5.2.40.0030.04010.76
5.2.30.0000.05010.80
5.2.20.0130.04710.96
5.2.10.0000.04310.61
5.2.00.0100.03710.56
5.1.60.0030.04310.07
5.1.50.0070.03710.14
5.1.40.0130.0379.83
5.1.30.0030.03710.41
5.1.20.0070.03310.27
5.1.10.0100.0339.91
5.1.00.0070.03710.03
5.0.50.0000.0338.40
5.0.40.0070.0238.46
5.0.30.0070.0408.41
5.0.20.0030.0308.38
5.0.10.0000.0308.17
5.0.00.0030.0508.34
4.4.90.0030.0207.02
4.4.80.0030.0207.02
4.4.70.0030.0207.02
4.4.60.0000.0237.02
4.4.50.0030.0207.02
4.4.40.0070.0337.02
4.4.30.0100.0137.02
4.4.20.0030.0237.02
4.4.10.0030.0207.02
4.4.00.0030.0307.02
4.3.110.0000.0277.02
4.3.100.0100.0177.02
4.3.90.0000.0237.02
4.3.80.0000.0337.02
4.3.70.0030.0177.02
4.3.60.0000.0207.02
4.3.50.0000.0237.02
4.3.40.0000.0337.02
4.3.30.0030.0207.02
4.3.20.0030.0207.02
4.3.10.0000.0237.02
4.3.00.0070.0179.33

preferences:
45.27 ms | 401 KiB | 5 Q