3v4l.org

run code in 300+ PHP versions simultaneously
<?php $depth = 0; $traverse = [0, 0, 0]; $tags = ['table', 'row', 'cell']; $regex = []; foreach ($tags as $key=>$tag) $regex[$key] = '/(\['.$tag.'((?:[\s\.\#]+[a-z]*)*)\]+[^\[]((?:.|\s)*?(?=(?:\['.$tag.')|$)))/'; echo var_export($tags),PHP_EOL; echo var_export($regex),PHP_EOL; $content = "[table] [row] [cell] [cell] [row] [cell] [cell] [table] [row] [row] [cell] [row] "; $f_parse = function($matches) use (&$depth, &$traverse, $tags, $regex, &$f_parse) { $traverse[++$depth]++; /* echo "$depth | ${traverse[$depth]} | $tags, ${regex[$depth]}", PHP_EOL; $result = ""; if ($depth < count($regex)) { preg_replace_callback( $regex[$depth], $f_parse, $matches[0] ); } return $result;*/ echo $depth, ' | ', $traverse[$depth], ' | ', PHP_EOL; $traverse[$depth--]--; return $depth; }; $content = preg_replace_callback( $regex[$depth], $f_parse, $content ); echo $content, "\n"; ?>

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.0210.00017.00
8.3.50.0120.00618.22
8.3.40.0070.01518.88
8.3.30.0100.00519.02
8.3.20.0060.00321.91
8.3.10.0040.00423.70
8.3.00.0040.00419.69
8.2.180.0180.00418.41
8.2.170.0120.00322.96
8.2.160.0110.00319.44
8.2.150.0000.00824.18
8.2.140.0000.00724.66
8.2.130.0000.00826.16
8.2.120.0000.00821.11
8.2.110.0030.00622.37
8.2.100.0080.00417.93
8.2.90.0080.00019.25
8.2.80.0050.00318.05
8.2.70.0050.00317.74
8.2.60.0030.00617.93
8.2.50.0060.00318.10
8.2.40.0030.00520.55
8.2.30.0000.00819.44
8.2.20.0000.00718.23
8.2.10.0030.00618.20
8.2.00.0050.00318.18
8.1.280.0150.00625.92
8.1.270.0040.00420.64
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0040.00423.83
8.1.230.0000.01118.08
8.1.220.0040.00417.78
8.1.210.0050.00318.77
8.1.200.0060.00317.60
8.1.190.0090.00017.25
8.1.180.0030.00518.10
8.1.170.0000.00818.71
8.1.160.0040.00419.04
8.1.150.0050.00218.93
8.1.140.0020.00519.64
8.1.130.0050.00218.96
8.1.120.0040.00417.55
8.1.110.0040.00417.66
8.1.100.0030.00517.70
8.1.90.0040.00717.69
8.1.80.0040.00417.69
8.1.70.0040.00417.63
8.1.60.0040.00417.75
8.1.50.0090.00017.74
8.1.40.0060.00317.62
8.1.30.0030.00517.81
8.1.20.0030.00617.79
8.1.10.0040.00417.70
8.1.00.0080.00017.71
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0040.00418.40
8.0.270.0030.00317.29
8.0.260.0000.00717.32
8.0.250.0080.00317.05
8.0.240.0000.01017.13
8.0.230.0000.00717.18
8.0.220.0000.00716.97
8.0.210.0030.00317.05
8.0.200.0070.00017.16
8.0.190.0050.00617.16
8.0.180.0040.00417.08
8.0.170.0000.00717.00
8.0.160.0000.00717.12
8.0.150.0040.00416.92
8.0.140.0050.00217.05
8.0.130.0000.00713.52
8.0.120.0040.00417.11
8.0.110.0040.00416.97
8.0.100.0040.00417.04
8.0.90.0040.00417.04
8.0.80.0030.01217.04
8.0.70.0000.00817.13
8.0.60.0040.00417.15
8.0.50.0050.00216.95
8.0.30.0090.01017.32
8.0.20.0100.00917.45
8.0.10.0040.00417.08
8.0.00.0150.00316.99
7.4.330.0050.00015.55
7.4.320.0060.00016.86
7.4.300.0040.00416.71
7.4.290.0050.00316.66
7.4.280.0050.00216.88
7.4.270.0000.00816.77
7.4.260.0040.00416.73
7.4.250.0000.00816.86
7.4.240.0040.00416.75
7.4.230.0040.00416.70
7.4.220.0130.00616.88
7.4.210.0060.00816.80
7.4.200.0000.00716.56
7.4.160.0100.01016.92
7.4.150.0030.01317.40
7.4.140.0090.01517.86
7.4.130.0090.01216.88
7.4.120.0110.01016.78
7.4.110.0100.01416.80
7.4.100.0090.00916.80
7.4.90.0090.00916.81
7.4.80.0100.01119.39
7.4.70.0060.01816.67
7.4.60.0030.01516.83
7.4.50.0070.00716.75
7.4.40.0130.00316.77
7.4.30.0070.01616.88
7.4.00.0030.01515.25
7.3.330.0030.00313.43
7.3.320.0030.00313.55
7.3.310.0040.00416.66
7.3.300.0030.00516.58
7.3.290.0110.00416.52
7.3.280.0100.00916.52
7.3.270.0120.00617.40
7.3.260.0140.00316.80
7.3.250.0090.01016.66
7.3.240.0140.00916.77
7.3.230.0070.01116.57
7.3.210.0090.00916.55
7.3.200.0070.01016.51
7.3.190.0130.00316.61
7.3.180.0070.01016.82
7.3.170.0030.01416.78
7.3.160.0080.00816.60
7.3.10.0110.00317.06
7.3.00.0040.01116.86
7.2.330.0150.00816.82
7.2.320.0220.00316.85
7.2.310.0110.00717.00
7.2.300.0060.01216.83
7.2.290.0120.01216.92
7.2.130.0080.00816.81
7.2.120.0090.00317.19
7.2.110.0000.01216.92
7.2.100.0030.01317.05
7.2.90.0030.00917.11
7.2.80.0030.01316.96
7.2.70.0030.01017.20
7.2.60.0030.00917.09
7.2.50.0000.01117.27
7.2.40.0060.00316.87
7.2.30.0070.00317.06
7.2.20.0040.01217.29
7.2.10.0000.01217.23
7.2.00.0020.01018.33
7.1.250.0070.00715.95
7.1.200.0030.01016.14
7.1.70.0030.00717.16
7.1.60.0210.00715.66
7.1.50.0200.00734.93
7.1.40.0130.01034.58
7.1.30.0200.00734.59
7.1.20.0200.00734.67
7.1.10.0100.00316.73
7.1.00.0000.01316.76
7.0.200.0130.00716.88
7.0.190.0030.00716.63
7.0.180.0030.00716.43
7.0.170.0000.01016.52
7.0.160.0070.00316.42
7.0.150.0070.00316.28
7.0.140.0030.00716.29
7.0.130.0030.00716.64
7.0.120.0030.00716.57
7.0.110.0000.01016.51
7.0.100.0070.00316.41
7.0.90.0030.00716.61
7.0.80.0030.00716.38
7.0.70.0070.00716.45
7.0.60.0030.00716.46
7.0.50.0000.01016.39
7.0.40.0070.00316.57
7.0.30.0000.01016.73
7.0.20.0000.01016.55
7.0.10.0030.00716.45
7.0.00.0070.01016.49

preferences:
55.33 ms | 401 KiB | 5 Q