3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bbcode = <<<BBCODE [b]Check out this demo[/b] ¯\_(ツ)_/¯ [table] [**]header1[||]header2[||]header3[||]...[/**] [*]child1.1[|]child1.2[|]child1.3[|]... [*]child2.1[|]child2.2[|]child2.3[|]... [*]child3.1[|]child3.2[|]child3.3[|]... [*]...[|]...[|]...[|]... [/table] simple text [table] [**]a 1[||]and a 2[/**] [*]A[|]B [*]C[|]D [/table] [s]3, you're out[/s] blah BBCODE; function BBTableToHTML($m) { return "<table class=\"ui compact stripet yellow table\">\n" . preg_replace_callback_array( [ '~\[\*\*]([^[]*(?:\[(?!/?\*\*])[^[]*)*)\[/\*\*]~' => 'BBTHeadToHTML', '~(?:\[\*].*\R*)+~' => 'BBTBodyToHTML', '~\[\*](.*)~' => 'BBTBodyRowToHTML' ], $m[1] ) . "</table>"; } function BBTHeadToHTML($m) { return "\t<thead>\n" . "\t\t<tr>\n\t\t\t<th>" . str_replace('[||]', "</th>\n\t\t\t<th>", $m[1]) . "</th>\n\t\t</tr>\n" . "\t</thead>"; } function BBTBodyToHTML($m) { return "\t<tbody>\n{$m[0]}\t</tbody>\n"; } function BBTBodyRowToHTML($m) { return "\t\t<tr>\n\t\t\t<td>" . str_replace('[|]', "</td>\n\t\t\t<td>", $m[1]) . "</td>\n\t\t</tr>"; } echo preg_replace_callback( '~\[table]\R*([^[]*(?:\[(?!/?table])[^[]*)*)\R*\[/table]~', 'BBTableToHTML', $bbcode );

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.4.140.0130.00918.04
8.4.130.0110.01018.60
8.4.120.0120.00824.09
8.4.110.0110.01020.71
8.4.100.0120.00917.97
8.4.90.0150.00520.64
8.4.80.0120.00620.71
8.4.70.0110.00818.83
8.4.60.0150.00720.41
8.4.50.0130.00920.41
8.4.40.0140.00719.75
8.4.30.0100.01020.57
8.4.20.0120.00418.84
8.4.10.0060.01019.68
8.3.270.0130.00716.77
8.3.260.0110.00816.73
8.3.250.0100.00919.10
8.3.240.0090.01117.39
8.3.230.0160.00616.92
8.3.220.0130.00619.00
8.3.210.0080.01216.80
8.3.200.0030.00516.99
8.3.190.0050.00717.23
8.3.180.0090.00919.05
8.3.170.0100.01017.36
8.3.160.0090.00916.55
8.3.150.0110.00718.98
8.3.140.0120.00817.28
8.3.130.0100.00017.06
8.3.120.0030.00620.91
8.3.110.0070.00318.46
8.3.100.0030.01616.66
8.3.90.0050.00326.77
8.3.80.0060.00318.30
8.3.70.0100.01016.73
8.3.60.0070.00716.63
8.3.50.0060.00724.48
8.3.40.0210.00019.18
8.3.30.0040.01118.81
8.3.20.0040.00420.94
8.3.10.0050.00323.70
8.3.00.0080.00020.67
8.2.290.0080.00117.46
8.2.280.0120.00718.79
8.2.270.0100.00016.79
8.2.260.0040.00419.01
8.2.250.0080.00017.16
8.2.240.0130.00717.07
8.2.230.0060.01320.94
8.2.220.0050.00524.06
8.2.210.0000.00826.77
8.2.200.0030.00618.66
8.2.190.0130.01016.88
8.2.180.0040.01518.66
8.2.170.0070.01122.96
8.2.160.0030.01022.34
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0090.00026.16
8.2.120.0140.00420.91
8.2.110.0070.00421.23
8.2.100.0080.00318.09
8.2.90.0080.00019.35
8.2.80.0000.00819.33
8.2.70.0040.00417.88
8.2.60.0000.00917.88
8.2.50.0080.00017.88
8.2.40.0000.00921.02
8.2.30.0040.00419.39
8.2.20.0000.00818.07
8.2.10.0040.00419.20
8.2.00.0020.00519.38
8.1.330.0140.00621.98
8.1.320.0110.00816.64
8.1.310.0130.00616.41
8.1.300.0070.00316.55
8.1.290.0100.00018.88
8.1.280.0080.00825.92
8.1.270.0080.00020.94
8.1.260.0090.00026.35
8.1.250.0030.00528.09
8.1.240.0030.00622.80
8.1.230.0070.00418.02
8.1.220.0040.00417.79
8.1.210.0060.00319.26
8.1.200.0040.00417.72
8.1.190.0060.00317.60
8.1.180.0030.00618.10
8.1.170.0000.00818.88
8.1.160.0050.00220.34
8.1.150.0000.00819.03
8.1.140.0040.00418.96
8.1.130.0040.00420.20
8.1.120.0000.00717.73
8.1.110.0080.00017.66
8.1.100.0000.00817.66
8.1.90.0000.00817.56
8.1.80.0030.00617.61
8.1.70.0000.00717.65
8.1.60.0000.00817.67
8.1.50.0060.00617.73
8.1.40.0040.00417.71
8.1.30.0000.00817.87
8.1.20.0030.00617.75
8.1.10.0030.00517.74
8.1.00.0040.00417.73
8.0.300.0050.00318.77
8.0.290.0000.00717.00
8.0.280.0050.00218.52
8.0.270.0080.00017.34
8.0.260.0030.00320.17
8.0.250.0000.00917.21
8.0.240.0000.00717.23
8.0.230.0070.00017.15
8.0.220.0040.00417.16
8.0.210.0030.00317.11
8.0.200.0030.00517.28
8.0.190.0000.00817.19
8.0.180.0040.00417.16
8.0.170.0050.00517.09
8.0.160.0040.00417.17
8.0.150.0040.00417.11
8.0.140.0030.00517.11
8.0.130.0060.00013.67
8.0.120.0000.00817.11
8.0.110.0030.00617.04
8.0.100.0080.00017.13
8.0.90.0030.00616.96
8.0.80.0140.00617.10
8.0.70.0020.00516.94
8.0.60.0040.00417.13
8.0.50.0040.00417.11
8.0.30.0050.01117.12
8.0.20.0090.01017.59
8.0.10.0000.00717.14
8.0.00.0130.00816.97
7.4.330.0050.00015.55
7.4.320.0060.00016.75
7.4.300.0030.00316.70
7.4.290.0030.00516.70
7.4.280.0040.00416.60
7.4.270.0070.00016.72
7.4.260.0060.00013.42
7.4.250.0030.00516.68
7.4.240.0020.00616.83
7.4.230.0070.00016.70
7.4.220.0030.00316.69
7.4.210.0110.00416.79
7.4.200.0000.00716.90
7.4.130.0060.01216.78
7.4.120.0110.01416.68
7.4.110.0100.00916.65
7.4.100.0040.01416.82
7.4.90.0120.00616.83
7.4.80.0150.00619.39
7.4.70.0130.01016.56
7.4.60.0090.00916.72
7.4.50.0100.00716.78
7.4.40.0100.00716.68
7.4.00.0040.01115.44
7.3.330.0040.00416.66
7.3.320.0030.00313.41
7.3.310.0030.00316.59
7.3.300.0000.00716.42
7.3.290.0070.01016.49
7.3.280.0060.01516.47
7.3.260.0070.01716.74
7.3.230.0150.00316.57
7.3.210.0030.01416.63
7.3.200.0110.00916.81
7.3.190.0000.01616.85
7.3.180.0100.01016.71
7.3.170.0070.01016.52
7.3.160.0060.01016.67
7.3.120.0070.00715.04
7.3.110.0090.00615.23
7.3.100.0100.00515.05
7.3.90.0090.00615.24
7.3.80.0000.01414.58
7.3.70.0110.01014.76
7.3.60.0040.01114.65
7.3.50.0140.00515.04
7.3.40.0070.00815.05
7.3.30.0030.01115.02
7.3.20.0100.00715.07
7.3.10.0090.01514.68
7.3.00.0090.00615.17
7.2.330.0210.00316.72
7.2.320.0070.01016.68
7.2.310.0080.00816.96
7.2.300.0100.00716.87
7.2.290.0170.00016.72
7.2.240.0090.00914.91
7.2.230.0130.00315.26
7.2.220.0150.01214.99
7.2.210.0030.01015.37
7.2.200.0030.01215.25
7.2.190.0070.01015.29
7.2.180.0100.00614.98
7.2.170.0030.01415.26
7.2.160.0060.00915.05
7.2.150.0060.00915.43
7.2.140.0150.00015.32
7.2.130.0120.00815.37
7.2.120.0110.00815.39
7.2.110.0080.00815.33
7.2.100.0060.00915.09
7.2.90.0040.01615.18
7.2.80.0090.00615.32
7.2.70.0080.00915.46
7.2.60.0080.01115.27
7.2.50.0030.01215.23
7.2.40.0080.00815.42
7.2.30.0040.01215.31
7.2.20.0060.01115.31
7.2.10.0280.01715.46
7.2.00.0060.01615.23
7.1.330.0120.00314.38
7.1.320.0050.01013.88
7.1.310.0060.00814.21
7.1.300.0090.00913.90
7.1.290.0070.01314.17
7.1.280.0150.00313.94
7.1.270.0100.00514.16
7.1.260.0060.01514.20
7.1.250.0120.00214.18

preferences:
137.36 ms | 403 KiB | 5 Q