3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html=<<<HTML <a href="bla">123 "this" is asd</a> <a href="bla">this should not be captured</a> <a href="bla">no quotes in anchor text here</a> <a href="bla">"445 is in quotes"</a> <a href="bla">asd "blabla" sometimes</a> <a href="bla">Je commence à avoir mal à la tête</a> <a href="bla">something with quotes like “blabla” is bad</a> HTML; $dom = new DOMDocument; $html=mb_convert_encoding($html,'HTML-ENTITIES',"UTF-8"); $dom->loadHTML($html,LIBXML_HTML_NODEFDTD); // 2nd params to remove DOCTYPE); foreach($dom->getElementsByTagName('a') as $a){ //echo $a->nodeValue,"\n"; if(preg_match('~["“”]~u',$a->nodeValue)){ $remove[]=$a; } } foreach($remove as $bad_a){ $bad_a->parentNode->removeChild($bad_a); } $result=mb_convert_encoding($dom->saveHTML(),"UTF-8",'HTML-ENTITIES'); echo preg_replace(['~^<html><body>|</body></html>$~','~\R+~'],['',"\n"],$result);

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.0090.00919.05
8.3.50.0110.00316.99
8.3.40.0060.00919.21
8.3.30.0040.01119.12
8.3.20.0040.00420.41
8.3.10.0040.00423.91
8.3.00.0030.00519.79
8.2.180.0150.00725.92
8.2.170.0090.00622.96
8.2.160.0070.00720.73
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00421.41
8.2.110.0000.01022.65
8.2.100.0090.00318.22
8.2.90.0060.00318.53
8.2.80.0090.00018.13
8.2.70.0040.00418.18
8.2.60.0080.00018.28
8.2.50.0040.00418.47
8.2.40.0050.00322.68
8.2.30.0070.00019.68
8.2.20.0050.00318.61
8.2.10.0040.00418.50
8.2.00.0080.00018.66
8.1.280.0080.00825.92
8.1.270.0080.00022.48
8.1.260.0110.00726.35
8.1.250.0040.00428.09
8.1.240.0060.00322.62
8.1.230.0090.00321.16
8.1.220.0030.00517.91
8.1.210.0040.00419.34
8.1.200.0050.00317.75
8.1.190.0000.00719.35
8.1.180.0030.00618.10
8.1.170.0060.00319.16
8.1.160.0030.00619.28
8.1.150.0070.00020.56
8.1.140.0000.00717.96
8.1.130.0000.00819.35
8.1.120.0040.00418.00
8.1.110.0040.00417.86
8.1.100.0040.00417.88
8.1.90.0040.00417.98
8.1.80.0050.00317.85
8.1.70.0000.00817.84
8.1.60.0110.00018.08
8.1.50.0030.00518.00
8.1.40.0000.00918.07
8.1.30.0030.00618.04
8.1.20.0000.00818.08
8.1.10.0040.00418.02
8.1.00.0000.00817.93
8.0.300.0090.00020.20
8.0.290.0060.00317.38
8.0.280.0050.00318.81
8.0.270.0040.00417.41
8.0.260.0030.00617.30
8.0.250.0070.00017.46
8.0.240.0000.00717.39
8.0.230.0000.00717.54
8.0.220.0070.00317.45
8.0.210.0030.00317.46
8.0.200.0040.00417.43
8.0.190.0060.00317.55
8.0.180.0060.00617.51
8.0.170.0050.00517.53
8.0.160.0070.00417.53
8.0.150.0000.00817.44
8.0.140.0070.00317.41
8.0.130.0030.00313.89
8.0.120.0040.00417.45
8.0.110.0040.00417.46
8.0.100.0000.00717.25
8.0.90.0070.00017.64
8.0.80.0040.01217.31
8.0.70.0040.00417.53
8.0.60.0050.00317.42
8.0.50.0040.00417.37
8.0.30.0110.01017.61
8.0.20.0090.01217.53
8.0.10.0040.00417.63
8.0.00.0110.00817.45
7.4.330.0000.00515.55
7.4.320.0000.00616.99
7.4.300.0060.00017.09
7.4.290.0030.00316.95
7.4.280.0040.00417.09
7.4.270.0070.00017.12
7.4.260.0030.00317.13
7.4.250.0080.00017.09
7.4.240.0050.00417.02
7.4.230.0070.00017.14
7.4.220.0070.00016.93
7.4.210.0080.00816.94
7.4.200.0000.00717.17
7.4.160.0080.00917.02
7.4.150.0110.00817.40
7.4.140.0110.00917.86
7.4.130.0100.01017.00
7.4.120.0120.00817.05
7.4.110.0090.00916.94
7.4.100.0070.01016.99
7.4.90.0140.00317.11
7.4.80.0030.01419.39
7.4.70.0160.00917.23
7.4.60.0070.01017.05
7.4.50.0060.01017.38
7.4.40.0070.01017.11
7.4.00.0080.00915.45
7.3.330.0000.00513.68
7.3.320.0030.00313.60
7.3.310.0030.00316.84
7.3.300.0000.00716.67
7.3.290.0100.00616.85
7.3.280.0070.00916.82
7.3.270.0120.00617.40
7.3.260.0110.00817.01
7.3.240.0130.00516.92
7.3.230.0120.00917.02
7.3.210.0080.01216.99
7.3.200.0130.01116.83
7.3.190.0070.01416.86
7.3.180.0150.00816.97
7.3.170.0060.00916.86
7.3.160.0130.00817.02
7.3.120.0060.01115.36
7.3.110.0030.01415.18
7.3.100.0050.01315.30
7.3.90.0050.00915.17
7.3.80.0040.01115.28
7.3.70.0080.00515.01
7.3.60.0030.01115.14
7.3.50.0070.00715.15
7.3.40.0100.00315.20
7.3.30.0040.00815.17
7.3.20.0090.00417.03
7.3.10.0040.00816.89
7.3.00.0060.01017.02
7.2.330.0110.00717.17
7.2.320.0070.01316.98
7.2.310.0070.01117.22
7.2.300.0070.01017.16
7.2.290.0060.01217.06
7.2.250.0100.01015.64
7.2.240.0050.01015.39
7.2.230.0060.00915.47
7.2.220.0030.00915.54
7.2.210.0050.00915.43
7.2.200.0020.01115.51
7.2.190.0050.01315.51
7.2.180.0070.00615.44
7.2.170.0070.00715.60
7.2.160.0040.01115.32
7.2.150.0040.01117.19
7.2.140.0000.01517.09
7.2.130.0030.00717.14
7.2.120.0060.00617.34
7.2.110.0030.01017.21
7.2.100.0080.00817.30
7.2.90.0110.00417.18
7.2.80.0050.00517.31
7.2.70.0000.01617.44
7.2.60.0030.00717.30
7.2.50.0070.01117.38
7.2.40.0040.01117.17
7.2.30.0070.01117.09
7.2.20.0080.00918.83
7.2.10.0070.01418.54
7.2.00.0060.01218.53
7.1.330.0070.00715.99
7.1.320.0030.01016.28
7.1.310.0050.00916.11
7.1.300.0070.00516.07
7.1.290.0030.00916.02
7.1.280.0050.00716.11
7.1.270.0060.00616.02
7.1.260.0020.01316.16
7.1.250.0090.00316.30
7.1.200.0070.00716.02
7.1.140.0060.01219.30
7.1.130.0120.01119.01
7.1.120.0070.01719.16
7.1.110.0080.01318.62
7.1.100.0060.01518.45
7.1.90.0060.01518.41
7.1.80.0060.01018.64
7.1.70.0070.01117.61
7.1.60.0300.02034.96
7.1.50.0230.01334.76
7.1.40.0310.01534.29
7.1.30.0250.01234.38
7.1.20.0260.02434.60
7.1.10.0080.01317.11
7.1.00.0050.01117.17

preferences:
58.62 ms | 400 KiB | 5 Q