3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<ul><li><a href="test.php">Test</a>(10)</li></ul>'; echo $string; $dom_document = new DOMDocument(); $dom_document->loadHTML($string); $new_string = ""; foreach($dom_document->getElementsByTagName('ul') as $ul){ // For all ul. $new_string .= "<ul>"; foreach($ul->childNodes as $li){ // For all li. $new_string .= "<li>"; $i=0; foreach($li->childNodes as $a){ if(isset($a->attributes[0]->value)){ $href = $a->attributes[0]->value; } if($i===0){ $new_string .= '<a href="'.$href.'">'; } $new_string .= $a->nodeValue; $i++; } $new_string .= "</a>"; $new_string .= "</li>"; } $new_string .= "</ul>"; } echo $new_string; ?>

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.40.0110.00419.08
8.3.30.0060.01518.96
8.3.20.0050.00320.54
8.3.10.0000.00821.98
8.3.00.0110.00720.31
8.2.170.0090.00622.96
8.2.160.0090.00620.56
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0080.00021.05
8.2.120.0040.00426.35
8.2.110.0050.00521.15
8.2.100.0030.00918.47
8.2.90.0040.00419.53
8.2.80.0050.00318.18
8.2.70.0060.00617.61
8.2.60.0040.00418.18
8.2.50.0030.00518.29
8.2.40.0030.00520.71
8.2.30.0040.00421.24
8.2.20.0040.00418.46
8.2.10.0030.00618.32
8.2.00.0030.00518.26
8.1.270.0000.00822.45
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00024.13
8.1.230.0080.00319.25
8.1.220.0000.00818.01
8.1.210.0060.00318.77
8.1.200.0030.00617.60
8.1.190.0000.00817.48
8.1.180.0000.00818.10
8.1.170.0050.00320.54
8.1.160.0040.00419.24
8.1.150.0020.00519.17
8.1.140.0030.00619.72
8.1.130.0000.00719.10
8.1.120.0000.00817.61
8.1.110.0050.00317.66
8.1.100.0050.00317.56
8.1.90.0070.00017.67
8.1.80.0070.00417.71
8.1.70.0000.00717.68
8.1.60.0060.00317.81
8.1.50.0040.00417.66
8.1.40.0030.00617.68
8.1.30.0000.00917.77
8.1.20.0030.00617.83
8.1.10.0030.00617.70
8.1.00.0030.00517.73
8.0.300.0040.00418.77
8.0.290.0060.00316.88
8.0.280.0000.00718.57
8.0.270.0000.00717.50
8.0.260.0000.00717.02
8.0.250.0030.00317.12
8.0.240.0000.00717.04
8.0.230.0070.00017.16
8.0.220.0080.00017.02
8.0.210.0030.00317.02
8.0.200.0040.00417.20
8.0.190.0050.00317.09
8.0.180.0030.00617.03
8.0.170.0000.00817.04
8.0.160.0000.00717.13
8.0.150.0050.00216.95
8.0.140.0040.00416.95
8.0.130.0040.00413.46
8.0.120.0000.00717.08
8.0.110.0040.00417.12
8.0.100.0000.00717.20
8.0.90.0000.00816.86
8.0.80.0050.01117.14
8.0.70.0040.00416.89
8.0.60.0000.00717.11
8.0.50.0040.00417.16
8.0.30.0050.01317.15
8.0.20.0080.01117.40
8.0.10.0000.00717.32
8.0.00.0150.00916.97
7.4.330.0000.00715.55
7.4.320.0000.00716.90
7.4.300.0060.00016.91
7.4.290.0040.00416.70
7.4.280.0030.00516.77
7.4.270.0050.00316.61
7.4.260.0030.00316.86
7.4.250.0040.00416.52
7.4.240.0050.00316.73
7.4.230.0030.00316.84
7.4.220.0070.01116.88
7.4.210.0040.01116.65
7.4.200.0030.00316.74
7.4.160.0090.00616.82
7.4.150.0070.01017.40
7.4.140.0080.01117.86
7.4.130.0100.01016.63
7.4.120.0080.01016.79
7.4.110.0080.00816.86
7.4.100.0100.00716.90
7.4.90.0140.00416.52
7.4.80.0110.00819.39
7.4.70.0100.00716.72
7.4.60.0110.00716.60
7.4.50.0060.00916.77
7.4.40.0140.00316.47
7.4.30.0100.00716.72
7.4.00.0070.01115.10
7.3.330.0000.00613.30
7.3.320.0050.00013.29
7.3.310.0030.00316.60
7.3.300.0030.00316.43
7.3.290.0000.00716.41
7.3.280.0080.00816.48
7.3.270.0100.00717.40
7.3.260.0050.01316.74
7.3.250.0080.01216.67
7.3.240.0070.01216.77
7.3.230.0050.02016.55
7.3.210.0070.01016.55
7.3.200.0060.01016.50
7.3.190.0000.01716.44
7.3.180.0100.00716.88
7.3.170.0080.00816.82
7.3.160.0110.01416.73
7.3.120.0100.00715.29
7.3.110.0040.01114.80
7.3.100.0040.01014.84
7.3.90.0070.00715.02
7.3.80.0000.01714.97
7.3.70.0030.00615.01
7.3.60.0060.00914.87
7.3.50.0090.00615.16
7.3.40.0040.01114.61
7.3.30.0070.01014.82
7.3.20.0070.00716.57
7.3.10.0090.00616.89
7.3.00.0040.00816.74
7.2.330.0060.01317.00
7.2.320.0130.00317.04
7.2.310.0080.00816.84
7.2.300.0090.01217.07
7.2.290.0080.00916.95
7.2.250.0100.00714.90
7.2.240.0100.01015.25
7.2.230.0060.00915.50
7.2.220.0070.00715.14
7.2.210.0040.01115.09
7.2.200.0000.00914.98
7.2.190.0130.00715.30
7.2.180.0080.00415.25
7.2.170.0030.00814.98
7.2.60.0060.00917.16
7.2.00.0000.01219.27
7.1.330.0070.00715.68
7.1.320.0000.01315.80
7.1.310.0000.01416.01
7.1.300.0040.01415.53
7.1.290.0080.00315.80
7.1.280.0110.00415.99
7.1.270.0120.00316.15
7.1.260.0000.01215.64
7.1.200.0030.01015.69
7.1.100.0040.00718.33
7.1.70.0040.01517.45
7.1.60.0320.01235.08
7.1.50.0290.01634.97
7.1.40.0320.01434.33
7.1.30.0280.01034.52
7.1.20.0340.01034.67
7.1.10.0060.01316.88
7.1.00.0060.01416.78
7.0.200.0030.01816.57
7.0.190.0060.01216.70
7.0.180.0090.00916.32
7.0.170.0030.01816.30
7.0.160.0060.01416.38
7.0.150.0090.00916.29
7.0.140.0080.00816.42
7.0.130.0130.00416.51
7.0.120.0120.01216.53
7.0.110.0060.01516.45
7.0.100.0080.01116.47
7.0.90.0120.00616.44
7.0.80.0070.01016.68
7.0.70.0120.00916.36
7.0.60.0140.00716.11
7.0.50.0020.01816.64
7.0.40.0070.01116.38
7.0.30.0050.01116.68
7.0.20.0070.00916.44
7.0.10.0030.01416.52
7.0.00.0060.01116.40

preferences:
38.43 ms | 400 KiB | 5 Q