3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<'HTML' <!DOCTYPE html> <html> <head> <script> let a=123; // comment // second comment let b='https://www.bbc.co.uk'; // This is a comment /* This is another comment */ // The following is not a comment var src="//google.com"; toolbar.querySelector('.toolbar-format_italic').addEventListener('click', function () { doInsertAtCursor(textarea, "///", "///"); doRefreshPreview(textarea); }.bind(_self)); /* Comment */ Prism.languages.javascript = Prism.languages.extend( regex: { pattern: RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"), lookbehind: !0, greedy: !0, inside: { "regex-source": { pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/, lookbehind: !0, alias: "language-regex", inside: Prism.languages.regex }, "regex-delimiter": /^\/|\/$/, "regex-flags": /^[a-z]+$/ } }); text = text.replace(/\/\/\/(.*?)\/\/\//g, "<em>$1<\/em>"); </script> </head> <body> </body> </html> HTML; libxml_use_internal_errors(true); $dom = new DOMDocument; $dom->loadHTML($html); $scriptNodes = $dom->getElementsByTagName('script'); $pattern = <<<'EOD' ~ (?(DEFINE) (?<squoted> ' [^'\n\\]*+ (?: \\. [^'\n\\]* )*+ ' ) (?<dquoted> " [^"\n\\]*+ (?: \\. [^"\n\\]* )*+ " ) (?<tquoted> ` [^`\\]*+ (?s: \\. [^`\\]*)*+ ` ) (?<quoted> \g<squoted> | \g<dquoted> | \g<tquoted> ) (?<scomment> // \N* ) (?<mcomment> /\* [^*]*+ (?: \*+ (?!/) [^*]* )*+ \*/ ) (?<comment> \g<scomment> | \g<mcomment> ) (?<pattern> / (?=[^\n/*]) [^\n/\\]*+ (?>\\.[^\n/\\]*)* / [gimuy]* ) ) (?=[[(:,=/"'`]) (?| \g<quoted> (*SKIP)(*FAIL) | ( [[(:,=] \s* ) (*SKIP) (?: \g<comment> \s* )*+ ( \g<pattern> ) | ( \g<pattern> \s* ) (?: \g<comment> \s* )*+ ( \. \s* ) (?:\g<comment> \s* )*+ ([A-Za-z_]\w*) | \g<comment> ) ~x EOD; foreach ($scriptNodes as $scriptNode) { $scriptNode->nodeValue = preg_replace($pattern, '$9${10}${11}', $scriptNode->nodeValue); } $html = $dom->saveHTML(); echo $html; ?>

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.130.0110.01118.20
8.4.120.0100.01020.55
8.4.110.0140.00722.73
8.4.100.0050.00818.20
8.4.90.0150.00619.18
8.4.80.0120.00818.91
8.4.70.0140.00618.24
8.4.60.0130.00820.88
8.4.50.0120.00920.69
8.4.40.0120.00917.92
8.4.30.0040.00420.88
8.4.20.0120.00620.18
8.4.10.0000.00922.24
8.3.260.0070.01617.10
8.3.250.0110.01019.22
8.3.240.0150.00617.00
8.3.230.0110.00917.05
8.3.220.0130.00617.79
8.3.210.0130.00818.69
8.3.200.0060.00316.88
8.3.190.0050.00517.78
8.3.180.0120.00816.86
8.3.170.0100.00017.66
8.3.160.0100.00719.44
8.3.150.0030.00617.39
8.3.140.0060.01217.63
8.3.130.0060.01318.84
8.3.120.0090.00021.13
8.3.110.0080.00820.94
8.3.100.0090.00916.94
8.3.90.0140.00426.77
8.3.80.0030.00617.97
8.3.70.0030.01318.93
8.3.60.0120.00917.13
8.3.50.0180.00018.76
8.3.40.0110.00422.00
8.3.30.0110.00419.47
8.3.20.0090.00024.18
8.3.10.0000.00824.66
8.3.00.0080.00026.16
8.2.290.0120.00620.75
8.2.280.0050.00418.98
8.2.270.0030.01517.65
8.2.260.0060.00318.91
8.2.250.0110.01118.91
8.2.240.0030.00617.41
8.2.230.0100.00022.58
8.2.220.0030.00624.06
8.2.210.0160.00426.77
8.2.200.0000.00916.88
8.2.190.0070.00716.88
8.2.180.0070.00717.13
8.2.170.0110.00419.41
8.2.160.0160.00022.96
8.2.150.0030.00625.66
8.2.140.0030.00524.66
8.2.130.0080.00026.16
8.2.120.0060.00322.34
8.2.110.0000.01120.69
8.2.100.0030.00722.63
8.2.90.0060.00618.09
8.1.330.0120.00722.18
8.1.320.0090.01316.53
8.1.310.0040.00418.60
8.1.300.0040.00416.94
8.1.290.0030.00730.84
8.1.280.0070.01125.92
8.1.270.0080.00024.66
8.1.260.0080.00026.35
8.1.250.0000.00928.09
8.1.240.0000.01020.90
8.1.230.0100.00718.93

preferences:
25.4 ms | 403 KiB | 5 Q