3v4l.org

run code in 500+ PHP versions simultaneously
<?php $result = <<<HTML <a href="SOME_URL"> <a href="SOME_URL_2"> </a> </a> <a href="SOME_URL3"> <a href="SOME_URL_4"> </a> </a> <a href="SOME_URL_5"> </a> <a href="SOME_URL_6"> </a> HTML; $dom = new DOMDocument(); @$dom->loadHTML($result); foreach($dom->getElementsByTagName('a') as $link) { $tag_html = $dom->saveHTML($link); //Get tag inner html if (substr_count($tag_html, "href") > 1) { //If tag contains more than one href attribute preg_match_all('/href="([^"]*)"/is', $tag_html, $link_output, PREG_SET_ORDER); $output[] = $link_output[1][1]; //Output second href } else { //Not nested tag $output[] = $link->getAttribute('href'); //Output first href } } echo "<pre>"; print_r($output); echo "</pre>";

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.5.30.0090.00921.68
8.5.20.0100.00718.00
8.5.10.0110.00818.45
8.5.00.0150.00820.46
8.4.180.0130.01225.86
8.4.170.0040.00624.21
8.4.160.0100.01324.32
8.4.150.0050.00217.04
8.4.140.0160.00617.73
8.4.130.0120.00917.89
8.4.120.0090.01120.96
8.4.110.0100.00622.85
8.4.100.0100.01117.85
8.4.90.0100.01020.71
8.4.80.0040.00419.05
8.4.70.0120.01218.19
8.4.60.0090.01118.98
8.4.50.0150.00518.92
8.4.40.0030.01718.09
8.4.30.0080.00018.95
8.4.20.0140.00718.12
8.4.10.0130.00320.04
8.3.300.0100.01221.10
8.3.290.0130.00718.95
8.3.280.0140.00818.87
8.3.270.0110.00916.99
8.3.260.0110.00916.84
8.3.250.0160.00319.42
8.3.240.0080.00916.90
8.3.230.0090.01117.03
8.3.220.0080.01019.25
8.3.210.0120.00916.85
8.3.200.0050.00416.98
8.3.190.0050.00417.27
8.3.180.0150.00617.35
8.3.170.0120.00620.94
8.3.160.0080.01217.63
8.3.150.0070.01117.60
8.3.140.0040.00419.24
8.3.130.0050.00319.09
8.3.120.0030.00621.13
8.3.110.0070.00317.03
8.3.100.0040.00418.73
8.3.90.0140.00416.85
8.3.80.0000.00918.68
8.3.70.0110.00718.68
8.3.60.0090.00918.84
8.3.50.0180.00317.26
8.3.40.0140.00023.86
8.3.30.0070.00720.35
8.3.20.0080.00024.18
8.3.10.0100.01022.06
8.3.00.0140.01419.32
8.2.300.0120.00818.43
8.2.290.0110.00820.78
8.2.280.0130.00718.55
8.2.270.0110.00719.04
8.2.260.0110.00719.06
8.2.250.0080.00019.03
8.2.240.0000.00917.43
8.2.230.0060.00320.94
8.2.220.0030.00624.06
8.2.210.0030.01026.77
8.2.200.0080.00817.00
8.2.190.0070.00716.88
8.2.180.0110.00717.13
8.2.170.0150.00019.34
8.2.160.0070.01422.96
8.2.150.0000.00925.66
8.2.140.0130.00622.50
8.2.130.0140.00722.33
8.2.120.0130.01019.22
8.2.110.0130.00619.45
8.2.100.0180.00619.04
8.2.90.0040.01119.33
8.2.80.0040.00819.33
8.2.70.0280.00619.05
8.2.60.0060.00318.89
8.2.50.0170.00719.03
8.2.40.0100.01019.20
8.2.30.0040.01218.91
8.2.20.0090.00019.26
8.2.10.0110.00319.08
8.2.00.0100.00319.05
8.1.340.0100.01318.00
8.1.330.0130.00722.49
8.1.320.0100.01016.27
8.1.310.0100.01017.11
8.1.300.0060.00320.03
8.1.290.0040.00418.88
8.1.280.0030.01225.92
8.1.270.0080.00022.56
8.1.260.0060.00322.24
8.1.250.0090.00022.31
8.1.240.0040.00918.90
8.1.230.0000.00918.86
8.1.220.0030.00619.07
8.1.210.0110.00618.83
8.1.200.0030.00919.23
8.1.190.0120.00318.67
8.1.180.0100.00018.55
8.1.170.0050.00520.52
8.1.160.0080.00418.75
8.1.150.0130.00018.72
8.1.140.0110.00018.56
8.1.130.0080.00020.93
8.1.120.0120.00018.98
8.1.110.0110.00018.64
8.1.100.0090.00418.63
8.1.90.0000.00920.54
8.1.80.0140.00018.84
8.1.70.0120.00018.88
8.1.60.0110.00018.78
8.1.50.0050.00518.92
8.1.40.0000.00920.76
8.1.30.0040.00420.72
8.1.20.0070.00320.66
8.1.10.0090.00618.83
8.1.00.0160.00018.69

preferences:
45.57 ms | 991 KiB | 5 Q