3v4l.org

run code in 300+ PHP versions simultaneously
<?php $phpbb_code = '<!-- BEGIN navlinks --> <span>{navlinks.U_VIEW_FORUM}{$MICRODATA}{navlinks.MICRODATA}{navlinks.FORUM_NAME}</span> <!-- END navlinks -->'; function fix_begin_tokens($code, $parent_nodes = array()) { // PHP 5.3 cannot use $this in an anonymous function, so use this as a work-around $parent_class = $this; $callback = function ($matches) use ($parent_class, $parent_nodes) { $hard_parents = explode('.', $matches[1]); array_pop($hard_parents); // ends with . if ($hard_parents) { $parent_nodes = array_merge($hard_parents, $parent_nodes); } $name = $matches[2]; $subset = trim(substr($matches[3], 1, -1)); // Remove parenthesis $body = $matches[4]; // Replace <!-- BEGINELSE --> $body = str_replace('<!-- BEGINELSE -->', '{% else %}', $body); // Is the designer wanting to call another loop in a loop? // <!-- BEGIN loop --> // <!-- BEGIN !loop2 --> // <!-- END !loop2 --> // <!-- END loop --> // 'loop2' is actually on the same nesting level as 'loop' you assign // variables to it with template->assign_block_vars('loop2', array(...)) if (strpos($name, '!') === 0) { // Count the number if ! occurrences $count = substr_count($name, '!'); for ($i = 0; $i < $count; $i++) { array_pop($parent_nodes); $name = substr($name, 1); } } // Remove all parent nodes, e.g. foo, bar from foo.bar.foobar.VAR foreach ($parent_nodes as $node) { $body = preg_replace('#([^a-zA-Z0-9_])' . $node . '\.([a-zA-Z0-9_]+)\.#', '$1$2.', $body); } // Add current node to list of parent nodes for child nodes $parent_nodes[] = $name; // Recursive...fix any child nodes $body = $parent_class->fix_begin_tokens($body, $parent_nodes); // Need the parent variable name array_pop($parent_nodes); $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; if ($subset !== '') { $subset = '|subset(' . $subset . ')'; } $parent = ($parent) ?: 'loops.'; // Turn into a Twig for loop return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; }; return preg_replace_callback('#<!-- BEGIN ((?:[a-zA-Z0-9_]+\.)*)([!a-zA-Z0-9_]+)(\([0-9,\-]+\))? -->(.+?)<!-- END \1\2 -->#s', $callback, $code); } $code = fix_begin_tokens($phpbb_code, ''); echo $code;

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.0120.00616.75
8.3.50.0090.01021.28
8.3.40.0090.00618.79
8.3.30.0070.00718.53
8.3.20.0150.00320.16
8.3.10.0050.00323.66
8.3.00.0080.00019.56
8.2.180.0120.00916.63
8.2.170.0170.00322.96
8.2.160.0070.01020.12
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0090.00017.50
8.2.110.0000.01021.02
8.2.100.0040.00717.72
8.2.90.0000.00817.97
8.2.80.0030.00617.97
8.2.70.0060.00617.38
8.2.60.0050.00317.80
8.2.50.0030.00518.07
8.2.40.0000.00821.12
8.2.30.0080.00019.72
8.2.20.0020.00517.58
8.2.10.0040.00418.08
8.2.00.0000.00717.95
8.1.280.0120.00625.92
8.1.270.0060.01220.24
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00622.58
8.1.230.0000.01120.97
8.1.220.0000.00817.74
8.1.210.0000.00818.91
8.1.200.0040.00417.35
8.1.190.0040.00417.38
8.1.180.0040.00418.10
8.1.170.0040.00418.58
8.1.160.0000.00722.00
8.1.150.0040.00418.75
8.1.140.0050.00317.42
8.1.130.0040.00417.73
8.1.120.0050.00317.33
8.1.110.0040.00417.43
8.1.100.0040.00417.32
8.1.90.0040.00417.39
8.1.80.0040.00417.29
8.1.70.0000.00717.40
8.1.60.0030.00617.59
8.1.50.0030.00617.54
8.1.40.0040.00417.39
8.1.30.0000.00917.68
8.1.20.0050.00317.50
8.1.10.0070.00017.46
8.1.00.0030.00617.53
8.0.300.0070.00019.93
8.0.290.0040.00416.75
8.0.280.0030.00318.34
8.0.270.0040.00417.25
8.0.260.0030.00317.19
8.0.250.0040.00416.93
8.0.240.0080.00017.04
8.0.230.0040.00416.99
8.0.220.0030.00316.82
8.0.210.0040.00416.97
8.0.200.0000.00716.97
8.0.190.0000.00816.84
8.0.180.0000.00716.96
8.0.170.0040.00416.91
8.0.160.0040.00416.94
8.0.150.0070.00016.84
8.0.140.0040.00416.75
8.0.130.0000.00713.34
8.0.120.0080.00016.88
8.0.110.0040.00416.80
8.0.100.0050.00216.77
8.0.90.0000.00717.03
8.0.80.0060.00916.90
8.0.70.0040.00416.95
8.0.60.0000.00716.79
8.0.50.0030.00516.75
8.0.30.0050.01516.99
8.0.20.0140.00617.40
8.0.10.0050.00216.88
8.0.00.0120.00816.69
7.4.330.0050.00015.08
7.4.320.0000.00616.53
7.4.300.0070.00016.61
7.4.290.0030.00716.36
7.4.280.0040.00416.61
7.4.270.0030.00516.46
7.4.260.0000.00916.61
7.4.250.0040.00416.60
7.4.240.0020.00516.52
7.4.230.0040.00416.62
7.4.220.0150.00616.62
7.4.210.0100.00616.59
7.4.200.0040.00216.61
7.4.160.0000.02216.63
7.4.150.0160.00317.40
7.4.140.0110.01017.86
7.4.130.0100.00916.49
7.4.120.0110.01316.57
7.4.110.0090.00916.49
7.4.100.0090.00916.63
7.4.90.0110.00516.59
7.4.80.0060.01119.39
7.4.70.0150.00616.54
7.4.60.0060.01016.55
7.4.50.0040.00416.50
7.4.40.0130.00316.45
7.4.30.0190.00316.47
7.4.00.0060.00914.73
7.3.330.0030.00313.12
7.3.320.0030.00313.30
7.3.310.0070.00016.24
7.3.300.0000.00716.21
7.3.290.0060.01016.31
7.3.280.0090.01016.33
7.3.270.0150.01217.40
7.3.260.0100.00716.53
7.3.250.0130.00716.36
7.3.240.0100.01016.31
7.3.230.0030.01416.59
7.3.210.0140.00316.64
7.3.200.0100.00716.34
7.3.190.0030.01416.31
7.3.180.0120.01016.24
7.3.170.0000.01616.27
7.3.160.0100.01116.36
7.3.10.0060.00616.64
7.3.00.0030.01016.63
7.2.330.0110.00616.30
7.2.320.0130.01016.58
7.2.310.0150.00616.30
7.2.300.0100.00716.66
7.2.290.0150.00316.64
7.2.130.0060.00816.71
7.2.120.0070.01016.77
7.2.110.0060.00916.61
7.2.100.0040.00716.72
7.2.90.0060.00316.42
7.2.80.0080.00816.55
7.2.70.0030.01016.76
7.2.60.0020.01316.84
7.2.50.0040.01416.78
7.2.40.0120.00316.80
7.2.30.0080.00416.66
7.2.20.0040.00816.85
7.2.10.0060.00316.66
7.2.00.0030.00918.13
7.1.250.0080.00615.84
7.1.240.0040.00415.71
7.1.230.0070.00415.66
7.1.220.0110.00415.42
7.1.210.0090.00915.78
7.1.200.0090.00615.65
7.1.190.0000.01415.81
7.1.180.0130.00315.61
7.1.170.0060.00915.75
7.1.160.0060.00315.67
7.1.150.0040.01115.86
7.1.140.0000.01115.80
7.1.130.0080.00615.70
7.1.120.0100.00615.74
7.1.110.0000.01615.49
7.1.100.0050.00616.63
7.1.90.0080.00815.74
7.1.80.0030.00615.62
7.1.70.0000.01016.46
7.1.60.0100.00817.45
7.1.50.0070.00916.24
7.1.40.0030.00915.50
7.1.30.0070.00715.70
7.1.20.0000.00815.83
7.1.10.0070.00715.62
7.1.00.0070.04019.13
7.0.330.0030.00915.63
7.0.320.0090.00315.52
7.0.310.0000.01215.57
7.0.300.0090.00015.36
7.0.290.0110.00415.41
7.0.280.0070.00715.36
7.0.270.0070.00715.58
7.0.260.0030.00615.45
7.0.250.0040.01115.77
7.0.240.0060.00915.67
7.0.230.0000.01615.56
7.0.220.0080.00015.76
7.0.210.0000.01315.66
7.0.200.0100.00216.23
7.0.190.0090.00615.59
7.0.180.0030.01015.42
7.0.170.0100.00315.37
7.0.160.0000.01215.35
7.0.150.0030.00915.63
7.0.140.0060.00315.18
7.0.130.0100.00715.69
7.0.120.0000.00915.76
7.0.110.0030.00615.55
7.0.100.0030.01015.47
7.0.90.0030.01315.66
7.0.80.0040.00415.82
7.0.70.0060.00615.69
7.0.60.0030.02517.93
7.0.50.0040.03516.78
7.0.40.0110.04217.02
7.0.30.0150.03016.85
7.0.20.0200.03817.02
7.0.10.0080.03017.07
7.0.00.0050.04617.03
5.6.380.0130.00314.27
5.6.370.0030.01414.64
5.6.360.0070.00714.60
5.6.350.0070.00714.54
5.6.340.0070.00714.79
5.6.330.0090.00014.76
5.6.320.0070.01014.50
5.6.310.0030.01014.71
5.6.300.0080.00014.80
5.6.290.0070.00714.35
5.6.280.0080.03417.69
5.6.270.0130.00314.35
5.6.260.0030.00914.63
5.6.250.0030.01414.36
5.6.240.0070.00714.59
5.6.230.0000.00914.45
5.6.220.0060.00914.72
5.6.210.0060.04817.70
5.6.200.0050.02716.26
5.6.190.0080.02517.53
5.6.180.1720.02517.44
5.6.170.0150.02917.42
5.6.160.0030.02817.50
5.6.150.0030.03416.46
5.6.140.0050.02616.28
5.6.130.0070.04216.30
5.6.120.0090.04217.80
5.6.110.0080.02017.69
5.6.100.0100.03817.75
5.6.90.0050.03517.78
5.6.80.0080.03617.58
5.6.70.1700.02017.46
5.6.60.0080.00014.45
5.6.50.0050.00514.20
5.6.40.0080.00314.27
5.6.30.0030.00814.38
5.6.20.0050.00614.25
5.6.10.0000.01214.72
5.6.00.0040.00714.52
5.5.380.0030.00911.34
5.5.370.0030.01011.59
5.5.360.0000.00611.48
5.5.350.0120.04215.77
5.5.340.0050.02314.60
5.5.330.0130.03015.89
5.5.320.0130.02715.73
5.5.310.0130.04215.79
5.5.300.0040.02914.54
5.5.290.0030.03114.65
5.5.280.0110.02616.11
5.5.270.0060.04116.12
5.5.260.0020.02516.25
5.5.250.0070.04315.89
5.5.240.0170.03615.68
5.5.230.0080.00311.46
5.5.220.0040.00411.29
5.5.210.0030.00711.32
5.5.200.0000.00811.29
5.5.190.0000.00911.19
5.5.180.0030.00911.29
5.5.170.0060.00611.27
5.5.160.0090.00311.18
5.5.150.0000.00911.11
5.5.140.0030.00311.13
5.5.130.0080.00311.04
5.5.120.0030.00711.20
5.5.110.0000.00611.28
5.5.100.0030.00911.43
5.5.90.0060.00611.15
5.5.80.0000.00611.34
5.5.70.0030.00611.18
5.5.60.0000.01111.23
5.5.50.0060.00611.30
5.5.40.0000.01111.23
5.5.30.0000.00511.17
5.5.20.0000.01010.93
5.5.10.0040.00711.04
5.5.00.0060.00611.47
5.4.450.0380.03215.29
5.4.440.0600.03615.41
5.4.430.0520.03615.27
5.4.420.0380.03015.29
5.4.410.0320.03515.25
5.4.400.0430.02515.16
5.4.390.0500.03715.24
5.4.380.0610.03015.05
5.4.370.0430.03615.28
5.4.360.0460.04015.06
5.4.350.0420.03415.25
5.4.340.0490.04514.98
5.4.330.0100.00010.96
5.4.320.0450.03815.21
5.4.310.0400.04514.99
5.4.300.0430.03615.02
5.4.290.0340.02715.11
5.4.280.0300.03115.01
5.4.270.0330.02915.12
5.4.260.0280.04015.14
5.4.250.0430.02814.84
5.4.240.0140.03015.27
5.4.230.0100.03615.04
5.4.220.0000.03715.24
5.4.210.0320.02915.14
5.4.200.0380.03315.02
5.4.190.0410.04015.25
5.4.180.0350.03314.94
5.4.170.0470.02614.86
5.4.160.0400.03015.04
5.4.150.0330.03315.29
5.4.140.0430.03513.78
5.4.130.0430.02713.89
5.4.120.0380.02313.91
5.4.110.0430.03213.88
5.4.100.0370.03613.79
5.4.90.0460.02313.87
5.4.80.0380.02713.92
5.4.70.0080.03513.82
5.4.60.0170.02513.71
5.4.50.0030.03713.72
5.4.40.0120.02513.70
5.4.30.0000.03013.93
5.4.20.0130.02313.88
5.4.10.0030.00311.11
5.4.00.0080.00411.20

preferences:
60.02 ms | 401 KiB | 5 Q