3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dom = new DOMDocument(); $dom->loadHtml(' <a href="http://example.com/books/1">The Lord of the Rings</a> <ul> <li><a href="http://example.com/books/1#c1" >Chapter 1</a></li> <li><a name="name before href" href="http://example.com/books/1#c2">Chapter 2</a></li> <li><a href="http://example.com/books/1#c3" name="name after href">Chapter 3</a></li> <li><a href="http://example.com/books/1#cN" target="_blank">Chapter N</a></li> </ul> <br><br> <a href="http://example.com/books/1">Harry Potter</a> <ul> <li><a href="http://example.com/books/2#c1" target="_self">Chapter 1</a></li> <li><a href="http://example.com/books/2#c2" name="some have name" title="some others have title" >Chapter 2</a></li> <li><a href="http://example.com/books/2#c3">Chapter 3</a></li> <li><a href="http://example.com/books/2#cN" >Chapter N</a></li> </ul> ', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); foreach ($xpath->query("//a") as $link) { $href = $link->getAttribute('href'); if (strpos($href, '#') !== false) { $link->parentNode->nodeValue = $link->nodeValue; } } echo $dom->saveHTML();

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.10.0140.00719.77
8.3.140.0030.01317.21
8.3.130.0100.00616.98
8.3.120.0040.00419.53
8.3.110.0040.00420.94
8.3.100.0030.00624.06
8.3.90.0050.00326.77
8.3.80.0030.00719.36
8.3.70.0090.00618.67
8.3.60.0090.00918.68
8.3.50.0120.00317.84
8.3.40.0060.01319.21
8.3.30.0090.00619.14
8.3.20.0070.00023.98
8.3.10.0040.00423.90
8.3.00.0040.00422.32
8.2.260.0140.00421.31
8.2.250.0080.00017.00
8.2.240.0060.00317.75
8.2.230.0030.00622.58
8.2.220.0060.00337.54
8.2.210.0080.00026.77
8.2.200.0060.00318.88
8.2.190.0140.00417.00
8.2.180.0070.01016.75
8.2.170.0060.01022.96
8.2.160.0070.00720.95
8.2.150.0000.01125.66
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0040.00419.69
8.2.110.0040.00419.77
8.2.100.0070.00418.41
8.2.90.0040.00419.71
8.2.80.0040.00418.13
8.2.70.0030.00619.73
8.2.60.0080.00018.27
8.2.50.0040.00418.52
8.2.40.0000.00820.89
8.2.30.0070.00019.64
8.2.20.0050.00218.44
8.2.10.0000.00818.45
8.2.00.0000.00818.55
8.1.310.0110.00718.93
8.1.300.0050.00319.09
8.1.290.0030.00630.84
8.1.280.0060.00925.92
8.1.270.0000.00822.59
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00621.62
8.1.230.0040.00719.51
8.1.220.0040.00418.02
8.1.210.0060.00318.77
8.1.200.0060.00317.73
8.1.190.0040.00417.85
8.1.180.0000.00818.10
8.1.170.0080.00019.14
8.1.160.0040.00419.34
8.1.150.0070.00019.35
8.1.140.0000.00719.54
8.1.130.0050.00217.79
8.1.120.0000.00717.81
8.1.110.0060.00317.94
8.1.100.0040.00417.88
8.1.90.0040.00417.88
8.1.80.0050.00217.77
8.1.70.0070.00017.80
8.1.60.0030.00618.05
8.1.50.0040.00417.87
8.1.40.0090.00017.99
8.1.30.0030.00618.00
8.1.20.0050.00317.99
8.1.10.0040.00417.90
8.1.00.0050.00317.96
8.0.300.0040.00418.77
8.0.290.0030.00617.25
8.0.280.0000.00818.82
8.0.270.0040.00417.59
8.0.260.0000.00717.26
8.0.250.0040.00417.43
8.0.240.0000.00717.37
8.0.230.0050.00217.42
8.0.220.0070.00017.25
8.0.210.0000.00717.22
8.0.200.0030.00317.31
8.0.190.0000.00917.31
8.0.180.0040.00417.29
8.0.170.0060.00317.29
8.0.160.0000.00717.28
8.0.150.0040.00417.26
8.0.140.0030.00717.31
8.0.130.0060.00013.75
8.0.120.0050.00317.28
8.0.110.0040.00417.24
8.0.100.0050.00317.27
8.0.90.0040.00417.19
8.0.80.0100.01317.38
8.0.70.0040.00417.38
8.0.60.0000.00717.18
8.0.50.0070.00017.32
8.0.30.0120.00817.50
8.0.20.0110.00917.56
8.0.10.0000.00717.25
8.0.00.0110.00817.09
7.4.330.0000.00615.55
7.4.320.0030.00317.07
7.4.300.0030.00317.02
7.4.290.0000.00716.96
7.4.280.0060.00316.88
7.4.270.0030.00716.82
7.4.260.0070.00016.97
7.4.250.0030.00316.87
7.4.240.0030.00516.88
7.4.230.0030.00316.88
7.4.220.0000.00717.01
7.4.210.0060.01016.98
7.4.200.0050.00316.87
7.4.160.0110.01016.88
7.4.150.0060.01217.40
7.4.140.0100.00817.86
7.4.130.0060.01217.02
7.4.120.0100.00916.88
7.4.110.0080.01616.83
7.4.100.0060.01316.96
7.4.90.0140.00317.04
7.4.80.0060.01119.39
7.4.70.0090.01516.78
7.4.60.0080.00816.86
7.4.50.0100.00716.96
7.4.40.0070.01417.00
7.4.10.0130.00715.09
7.4.00.0110.00615.11
7.3.330.0050.00013.33
7.3.320.0000.00613.39
7.3.310.0050.00216.58
7.3.300.0070.00016.68
7.3.290.0150.00016.60
7.3.280.0050.01116.61
7.3.270.0120.00817.40
7.3.260.0110.00916.77
7.3.250.0100.00716.84
7.3.240.0110.00716.87
7.3.230.0100.00716.60
7.3.210.0070.01516.99
7.3.200.0040.01416.99
7.3.190.0060.01316.96
7.3.180.0160.00616.63
7.3.170.0100.00716.69
7.3.160.0090.00616.87
7.3.130.0080.00614.78
7.3.120.0070.01014.93
7.3.110.0150.00314.93
7.3.100.0030.01014.92
7.3.90.0110.00414.93
7.3.80.0060.00915.08
7.3.70.0080.00814.93
7.3.60.0110.00415.01
7.3.50.0030.01014.87
7.3.40.0070.00715.16
7.3.30.0060.00615.08
7.3.20.0030.01316.69
7.3.10.0060.01016.72
7.3.00.0060.00916.80
7.2.330.0090.01517.22
7.2.320.0030.01417.20
7.2.310.0030.01816.98
7.2.300.0130.00416.84
7.2.290.0080.00917.07
7.2.260.0110.00715.13
7.2.250.0080.01115.10
7.2.240.0090.00615.42
7.2.230.0060.00915.24
7.2.220.0030.00614.99
7.2.210.0110.00015.30
7.2.200.0000.01015.32
7.2.190.0110.00515.34
7.2.180.0060.00915.31
7.2.170.0060.00615.18
7.2.160.0040.00815.34
7.2.150.0040.00917.07
7.2.140.0000.01717.06
7.2.130.0000.00917.16
7.2.120.0060.00917.20
7.2.110.0060.00917.16
7.2.100.0040.00717.16
7.2.90.0030.01016.95
7.2.80.0060.00617.08
7.2.70.0070.00717.20
7.2.60.0090.00717.12
7.2.50.0060.00917.13
7.2.40.0000.01516.79
7.2.30.0110.00417.27
7.2.20.0070.00716.98
7.2.10.0140.00717.65
7.2.00.0100.01217.62
7.1.330.0070.00715.89
7.1.320.0030.01015.95
7.1.310.0040.01115.80
7.1.300.0070.00715.88
7.1.290.0000.00916.04
7.1.280.0070.00715.76
7.1.270.0080.00015.96
7.1.260.0070.01015.96
7.1.250.0070.00715.96
7.1.240.0030.01116.00
7.1.230.0030.01015.97
7.1.220.0090.00616.03
7.1.210.0040.01115.79
7.1.200.0060.00315.82
7.1.190.0070.01016.16
7.1.180.0000.01715.87
7.1.170.0040.00815.88
7.1.160.0000.01015.93
7.1.150.0090.00315.69
7.1.140.0030.00716.00
7.1.130.0040.01116.07
7.1.120.0050.01016.44
7.1.110.0110.00916.24
7.1.100.0080.01016.31
7.1.90.0130.00816.32
7.1.80.0140.00416.07
7.1.70.0090.00915.62
7.1.60.0220.00924.73
7.1.50.0190.00824.57
7.1.40.0210.00824.25
7.1.30.0150.00924.34
7.1.20.0160.01024.45
7.1.10.0110.00815.45
7.1.00.0170.00515.40
7.0.330.0070.00415.74
7.0.320.0080.00615.54
7.0.310.0030.01215.28
7.0.300.0030.00715.31
7.0.290.0110.00415.73
7.0.280.0040.00715.42
7.0.270.0030.01015.37
7.0.260.0030.00915.63
7.0.250.0180.00015.54
7.0.240.0090.00915.48
7.0.230.0030.00715.70
7.0.220.0090.00315.62
7.0.210.0030.01015.41
7.0.200.0130.00315.70
7.0.190.0060.00615.41
7.0.180.0070.00715.67
7.0.170.0070.00715.49
7.0.160.0040.00815.53
7.0.150.0070.00415.63
7.0.140.0070.01015.59
7.0.130.0000.01515.63
7.0.120.0040.00815.54
7.0.110.0040.00715.50
7.0.100.0000.01515.74
7.0.90.0070.00715.59
7.0.80.0060.00615.70
7.0.70.0040.00415.42
7.0.60.0040.01215.59
7.0.50.0110.00715.75
7.0.40.0080.00813.63
7.0.30.0000.00913.48
7.0.20.0040.01113.54
7.0.10.0070.00713.45
7.0.00.0030.01013.66
5.6.400.0030.01314.73
5.6.390.0040.00714.76
5.6.380.0100.00314.84
5.6.370.0000.01614.41
5.6.360.0070.00814.85
5.6.350.0060.00614.83
5.6.340.0090.00614.32
5.6.330.0060.01214.63
5.6.320.0060.00914.99
5.6.310.0030.00614.60
5.6.300.0000.01514.70
5.6.290.0090.00614.45
5.6.280.0120.00014.62
5.6.270.0060.00614.30
5.6.260.0000.01214.59
5.6.250.0050.00514.45
5.6.240.0070.00414.51
5.6.230.0080.00514.53
5.6.220.0060.00914.53
5.6.210.0090.00614.50
5.6.200.0090.00914.77
5.6.190.0030.01014.55
5.6.180.0040.01114.46
5.6.170.0110.00414.78
5.6.160.0040.01114.59
5.6.150.0000.01314.67
5.6.140.0000.01414.61
5.6.130.0030.00614.45
5.6.120.0090.00014.46
5.6.110.0080.00414.64
5.6.100.0070.00714.52
5.6.90.0040.01114.75
5.6.80.0110.00314.38
5.6.70.0070.00414.44
5.6.60.0030.01314.40
5.6.50.0000.01314.30
5.6.40.0140.00014.55
5.6.30.0060.00614.39
5.6.20.0120.00014.38
5.6.10.0080.00814.21
5.6.00.0030.01014.46

preferences:
32.82 ms | 403 KiB | 5 Q