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 = $this->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.0070.01416.50
8.3.50.0170.00821.10
8.3.40.0070.01718.85
8.3.30.0110.00418.85
8.3.20.0130.00420.07
8.3.10.0070.00023.48
8.3.00.0090.00019.57
8.2.180.0150.00017.00
8.2.170.0140.00722.96
8.2.160.0070.00720.47
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0030.00626.16
8.2.120.0070.00317.50
8.2.110.0100.00722.13
8.2.100.0090.00317.63
8.2.90.0080.00019.05
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0000.00817.88
8.2.50.0030.00618.07
8.2.40.0000.00819.36
8.2.30.0070.00019.77
8.2.20.0040.00417.61
8.2.10.0000.00718.07
8.2.00.0050.00318.01
8.1.280.0070.01025.92
8.1.270.0160.00320.11
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00022.51
8.1.230.0060.00617.42
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0060.00317.23
8.1.180.0030.00518.10
8.1.170.0060.00318.66
8.1.160.0030.00621.86
8.1.150.0040.00418.79
8.1.140.0040.00417.54
8.1.130.0000.00717.57
8.1.120.0000.00717.41
8.1.110.0080.00017.31
8.1.100.0000.00717.33
8.1.90.0040.00417.44
8.1.80.0040.00417.40
8.1.70.0050.00217.40
8.1.60.0040.00417.54
8.1.50.0000.00917.46
8.1.40.0060.00317.55
8.1.30.0030.00717.64
8.1.20.0000.00917.70
8.1.10.0040.00417.64
8.1.00.0050.00517.60
8.0.300.0060.00318.77
8.0.290.0020.00516.75
8.0.280.0030.00318.35
8.0.270.0040.00317.27
8.0.260.0000.00617.21
8.0.250.0000.00717.03
8.0.240.0030.00616.92
8.0.230.0000.00716.98
8.0.220.0000.00716.86
8.0.210.0040.00416.89
8.0.200.0030.00317.00
8.0.190.0080.00016.98
8.0.180.0050.00316.85
8.0.170.0000.00816.86
8.0.160.0070.00016.92
8.0.150.0000.00716.95
8.0.140.0000.00816.88
8.0.130.0070.00013.38
8.0.120.0030.00616.84
8.0.110.0040.00416.93
8.0.100.0000.00716.93
8.0.90.0040.00416.94
8.0.80.0140.00716.85
8.0.70.0070.00016.96
8.0.60.0000.00716.87
8.0.50.0050.00216.74
8.0.30.0110.00817.17
8.0.20.0080.01217.40
8.0.10.0070.00017.02
8.0.00.0090.01116.64
7.4.330.0000.00515.08
7.4.320.0030.00316.48
7.4.300.0060.00016.53
7.4.290.0100.00016.51
7.4.280.0040.00416.58
7.4.270.0070.00016.64
7.4.260.0080.00316.56
7.4.250.0000.00716.53
7.4.240.0020.00516.60
7.4.230.0040.00416.63
7.4.220.0070.01316.46
7.4.210.0110.01016.67
7.4.200.0000.00716.65
7.4.160.0150.00016.48
7.4.150.0120.00917.40
7.4.140.0110.01117.86
7.4.130.0120.00716.64
7.4.120.0130.00716.54
7.4.110.0060.01216.64
7.4.100.0170.00716.73
7.4.90.0060.01016.38
7.4.80.0160.00319.39
7.4.70.0100.00616.59
7.4.60.0130.00316.50
7.4.50.0040.00416.30
7.4.40.0120.00616.75
7.4.30.0160.00616.47
7.4.00.0000.01814.98
7.3.330.0000.00613.20
7.3.320.0030.00313.35
7.3.310.0070.00016.23
7.3.300.0000.00816.29
7.3.290.0180.00316.38
7.3.280.0090.01016.31
7.3.270.0070.01017.40
7.3.260.0100.00716.33
7.3.250.0120.00516.43
7.3.240.0070.01316.35
7.3.230.0080.00916.39
7.3.210.0090.01116.36
7.3.200.0060.00916.45
7.3.190.0090.00616.57
7.3.180.0080.00816.63
7.3.170.0100.00716.64
7.3.160.0090.01316.30
7.2.330.0150.00316.64
7.2.320.0130.00916.47
7.2.310.0100.01016.57
7.2.300.0110.00616.54
7.2.290.0120.00616.35
7.2.60.0100.00316.63
7.2.00.0030.01019.04
7.1.200.0060.00615.71
7.1.100.0000.01017.81
7.1.70.0000.00716.75
7.1.60.0090.01519.13
7.1.50.0000.02416.62
7.1.00.0030.07722.24
7.0.200.0040.00416.82
7.0.60.0070.08319.98
7.0.50.0100.05317.99
7.0.40.0170.07720.40
7.0.30.0430.07720.06
7.0.20.0270.08020.09
7.0.10.0000.09020.20
7.0.00.0070.07720.33
5.6.280.0030.05720.85
5.6.210.0130.03020.72
5.6.200.0030.04018.18
5.6.190.0100.04720.46
5.6.180.0300.08020.48
5.6.170.0270.04020.55
5.6.160.0030.04320.48
5.6.150.0030.04018.14
5.6.140.0070.03718.13
5.6.130.0000.04318.27
5.6.120.0130.08021.12
5.6.110.0130.08321.01
5.6.100.0130.06021.04
5.6.90.0130.03721.04
5.6.80.0070.08020.53
5.6.70.4100.03320.52
5.5.350.0070.06720.32
5.5.340.0070.07717.94
5.5.330.0130.08020.38
5.5.320.0200.04720.34
5.5.310.0370.06320.25
5.5.300.0100.07017.98
5.5.290.0030.09017.97
5.5.280.0030.08720.76
5.5.270.0200.07020.67
5.5.260.0130.08320.70
5.5.250.0030.05720.63
5.5.240.0000.07320.17
5.4.450.0600.06019.26
5.4.440.0700.05019.55
5.4.430.0570.06019.25
5.4.420.0670.05319.32
5.4.410.0600.05719.46
5.4.400.0770.04019.27
5.4.390.0700.04718.93
5.4.380.0630.05019.34
5.4.370.0670.04719.21
5.4.360.0700.06319.22
5.4.350.0900.04318.82
5.4.340.0700.04718.82
5.4.320.0600.05719.26
5.4.310.0700.04319.13
5.4.300.0630.05319.05
5.4.290.0600.05719.07
5.4.280.0730.04719.25
5.4.270.0730.04319.34
5.4.260.0570.06019.25
5.4.250.0630.05019.23
5.4.240.0630.05719.18
5.4.230.0600.05318.82
5.4.220.0600.05319.07
5.4.210.0700.04719.09
5.4.200.0800.06719.09
5.4.190.0770.04019.25
5.4.180.0770.06719.23
5.4.170.0930.06718.81
5.4.160.0870.04318.80
5.4.150.0870.05319.06
5.4.140.0830.04716.52
5.4.130.0870.05316.43
5.4.120.0570.05316.30
5.4.110.0730.04016.67
5.4.100.0630.04716.58
5.4.90.0700.05316.57
5.4.80.0670.04316.66
5.4.70.0230.05016.59
5.4.60.0330.06316.34
5.4.50.0000.04316.51
5.4.40.0070.08316.38
5.4.30.0030.04716.43
5.4.20.0130.04716.43

preferences:
55.03 ms | 401 KiB | 5 Q