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]++; if ($depth < count($regex)) { preg_replace_callback( $regex[$depth], $f_parse, $matches[0] ); } /* 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.70.0130.00318.43
8.3.60.0120.00917.00
8.3.50.0080.00818.56
8.3.40.0130.01019.17
8.3.30.0030.01318.99
8.3.20.0000.00821.68
8.3.10.0080.00023.65
8.3.00.0060.00319.91
8.2.190.0120.00316.88
8.2.180.0110.00718.71
8.2.170.0120.00322.96
8.2.160.0090.00919.58
8.2.150.0040.00425.66
8.2.140.0000.00924.66
8.2.130.0070.00020.58
8.2.120.0080.00026.35
8.2.110.0060.00322.43
8.2.100.0050.00517.97
8.2.90.0030.00619.27
8.2.80.0060.00317.97
8.2.70.0030.00617.88
8.2.60.0090.00018.03
8.2.50.0090.00018.10
8.2.40.0080.00020.59
8.2.30.0000.00819.50
8.2.20.0040.00418.25
8.2.10.0030.00518.26
8.2.00.0040.00418.25
8.1.280.0110.01125.92
8.1.270.0080.00020.64
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0060.00323.88
8.1.230.0070.00417.95
8.1.220.0060.00317.91
8.1.210.0040.00418.77
8.1.200.0070.00317.50
8.1.190.0080.00017.47
8.1.180.0040.00418.10
8.1.170.0000.00818.84
8.1.160.0040.00418.87
8.1.150.0000.00718.84
8.1.140.0030.00519.65
8.1.130.0000.00718.88
8.1.120.0040.00417.57
8.1.110.0030.00517.63
8.1.100.0000.00717.55
8.1.90.0070.00317.71
8.1.80.0050.00317.54
8.1.70.0030.00517.63
8.1.60.0040.00417.80
8.1.50.0080.00017.62
8.1.40.0090.00017.77
8.1.30.0000.00917.86
8.1.20.0040.00417.87
8.1.10.0040.00417.74
8.1.00.0080.00017.64
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0000.00718.52
8.0.270.0050.00217.29
8.0.260.0030.00317.33
8.0.250.0030.00717.22
8.0.240.0060.00317.23
8.0.230.0030.00417.12
8.0.220.0040.00417.12
8.0.210.0000.00817.12
8.0.200.0030.00317.25
8.0.190.0080.00417.21
8.0.180.0040.00417.14
8.0.170.0050.00217.13
8.0.160.0040.00417.19
8.0.150.0070.00017.14
8.0.140.0000.00817.15
8.0.130.0000.00613.57
8.0.120.0040.00417.10
8.0.110.0070.00017.13
8.0.100.0080.00017.09
8.0.90.0050.00317.06
8.0.80.0050.01017.11
8.0.70.0000.00717.21
8.0.60.0030.00517.21
8.0.50.0040.00417.09
8.0.30.0090.01017.23
8.0.20.0120.00717.53
8.0.10.0050.00317.14
8.0.00.0100.01316.88
7.4.330.0030.00315.55
7.4.320.0060.00016.84
7.4.300.0050.00216.77
7.4.290.0080.00016.80
7.4.280.0000.00816.76
7.4.270.0030.00616.84
7.4.260.0110.00016.73
7.4.250.0080.00016.87
7.4.240.0040.00416.86
7.4.230.0000.00716.57
7.4.220.0070.01116.78
7.4.210.0080.00816.80
7.4.200.0050.00316.87
7.4.160.0110.00916.85
7.4.150.0110.00717.40
7.4.140.0140.00817.86
7.4.130.0100.01016.79
7.4.120.0070.01416.79
7.4.110.0120.00616.82
7.4.100.0140.00316.84
7.4.90.0140.00416.72
7.4.80.0030.01419.39
7.4.70.0130.00616.61
7.4.60.0100.00716.84
7.4.50.0080.00816.57
7.4.40.0100.00716.59
7.4.30.0130.00616.67
7.4.10.0110.00316.89
7.4.00.0080.01115.91
7.3.330.0030.00313.45
7.3.320.0060.00013.54
7.3.310.0000.00816.61
7.3.300.0000.00716.67
7.3.290.0080.00716.60
7.3.280.0100.01016.61
7.3.270.0090.00917.40
7.3.260.0120.00716.65
7.3.250.0060.01316.63
7.3.240.0090.01216.70
7.3.230.0160.00316.54
7.3.210.0070.01116.73
7.3.200.0120.00616.50
7.3.190.0000.02316.77
7.3.180.0110.01116.77
7.3.170.0000.01616.66
7.3.160.0070.01717.04
7.3.130.0110.00816.63
7.3.120.0140.00716.45
7.3.110.0090.00916.64
7.3.100.0060.00916.46
7.3.90.0090.00916.58
7.3.80.0030.01316.70
7.3.70.0090.01216.59
7.3.60.0080.01116.55
7.3.50.0100.01016.58
7.3.40.0070.00716.51
7.3.30.0060.00616.58
7.3.20.0060.01218.27
7.3.10.0110.00318.40
7.3.00.0080.00418.35
7.2.330.0140.00716.94
7.2.320.0040.01416.68
7.2.310.0030.01516.83
7.2.300.0060.01216.92
7.2.290.0130.01016.83
7.2.260.0030.01017.03
7.2.250.0070.01016.77
7.2.240.0080.01116.70
7.2.230.0040.01216.80
7.2.220.0100.00916.78
7.2.210.0050.01416.75
7.2.200.0060.01516.63
7.2.190.0060.01016.75
7.2.180.0130.01016.76
7.2.170.0030.01016.85
7.2.160.0060.01217.02
7.2.150.0000.01718.43
7.2.140.0000.01618.26
7.2.130.0060.00918.87
7.2.120.0070.00718.66
7.2.110.0080.00918.61
7.2.100.0030.01418.61
7.2.90.0110.00418.61
7.2.80.0020.01217.64
7.2.70.0130.00418.66
7.2.60.0040.01117.91
7.2.50.0070.01018.75
7.2.40.0110.00418.77
7.2.30.0040.00918.61
7.2.20.0070.01118.58
7.2.10.0030.01418.45
7.2.00.0090.00719.18
7.1.330.0040.01617.50
7.1.320.0030.01417.58
7.1.310.0000.01317.38
7.1.300.0100.00717.41
7.1.290.0030.00917.53
7.1.280.0030.01317.34
7.1.270.0060.01217.36
7.1.260.0030.01017.50
7.1.250.0040.01217.58
7.1.240.0030.01017.39
7.1.230.0140.00317.50
7.1.220.0030.01017.47
7.1.210.0030.01517.57
7.1.200.0040.00716.78
7.1.190.0040.01217.55
7.1.180.0150.00017.47
7.1.170.0040.01117.53
7.1.160.0090.00317.38
7.1.150.0110.00417.49
7.1.140.0090.00617.43
7.1.130.0080.00617.55
7.1.120.0130.00017.32
7.1.110.0040.01117.67
7.1.100.0030.01017.55
7.1.90.0170.00017.52
7.1.80.0110.00717.27
7.1.70.0040.00717.46
7.1.60.0140.00616.55
7.1.50.0390.01326.28
7.1.40.0340.01125.40
7.1.30.0200.01225.19
7.1.20.0240.00825.24
7.1.10.0260.00516.21
7.1.00.0050.00917.25
7.0.330.0070.00717.07
7.0.320.0090.00317.43
7.0.310.0060.00917.18
7.0.300.0040.00817.27
7.0.290.0030.01417.22
7.0.280.0000.01617.16
7.0.270.0040.00717.16
7.0.260.0070.00717.05
7.0.250.0040.00817.23
7.0.240.0110.00416.99
7.0.230.0090.00617.04
7.0.220.0110.00716.80
7.0.210.0070.00317.17
7.0.200.0120.00316.89
7.0.190.0030.01216.89
7.0.180.0180.01015.83
7.0.170.0250.00715.91
7.0.160.0000.01216.70
7.0.150.0130.01215.85
7.0.140.0200.00916.09
7.0.130.0180.01016.02
7.0.120.0150.01516.03
7.0.110.0020.01317.03
7.0.100.0170.01216.89
7.0.90.0080.00716.82
7.0.80.0100.00316.88
7.0.70.0020.01116.86
7.0.60.0060.00716.89
7.0.50.0070.00716.81
7.0.40.0050.00715.95
7.0.30.0050.00915.87
7.0.20.0050.00515.86
7.0.10.0080.00515.93
7.0.00.0060.00616.05
5.6.400.0080.00815.91
5.6.390.0070.00715.73
5.6.380.0060.00615.68
5.6.370.0070.01016.26
5.6.360.0000.01516.26
5.6.350.0090.00616.11
5.6.340.0110.00016.09
5.6.330.0060.00916.12
5.6.320.0040.01116.14
5.6.310.0060.00616.46
5.6.300.0090.00616.25
5.6.290.0000.01216.36
5.6.280.0000.01716.20
5.6.270.0000.01516.24
5.6.260.0000.01316.16
5.6.250.0030.01316.11
5.6.240.0060.00916.28
5.6.230.0030.01015.98
5.6.220.0000.01616.11
5.6.210.0030.01416.09
5.6.200.0070.00416.06
5.6.190.0030.00916.07
5.6.180.0030.01015.99
5.6.170.0060.00616.11
5.6.160.0070.00715.84
5.6.150.0070.00716.01
5.6.140.0070.00715.94
5.6.130.0130.00316.23
5.6.120.0040.00816.21
5.6.110.0070.00716.00
5.6.100.0100.00315.98
5.6.90.0100.00316.19
5.6.80.0030.00715.96
5.6.70.0030.01316.27
5.6.60.0040.01116.00
5.6.50.0080.00815.92
5.6.40.0000.01015.97
5.6.30.0040.01115.92
5.6.20.0000.00915.99
5.6.10.0030.00815.91
5.6.00.0070.00716.33

preferences:
53.85 ms | 401 KiB | 5 Q