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.60.0170.00716.88
8.3.50.0110.00716.65
8.3.40.0120.00318.99
8.3.30.0070.01419.11
8.3.20.0070.00020.51
8.3.10.0080.00021.99
8.3.00.0040.00420.58
8.2.180.0140.00718.53
8.2.170.0070.00722.96
8.2.160.0030.01020.63
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0030.00520.99
8.2.120.0080.00026.35
8.2.110.0030.00621.05
8.2.100.0100.00318.47
8.2.90.0080.00018.32
8.2.80.0050.00318.16
8.2.70.0060.00318.05
8.2.60.0080.00018.18
8.2.50.0050.00318.30
8.2.40.0050.00220.70
8.2.30.0080.00021.20
8.2.20.0000.00818.36
8.2.10.0040.00418.32
8.2.00.0000.00718.26
8.1.280.0110.00725.92
8.1.270.0070.00022.36
8.1.260.0070.00026.35
8.1.250.0090.00028.09
8.1.240.0030.00622.25
8.1.230.0070.00422.94
8.1.220.0040.00417.91
8.1.210.0040.00418.77
8.1.200.0080.00317.50
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0090.00020.70
8.1.160.0040.00419.20
8.1.150.0040.00419.05
8.1.140.0090.00019.72
8.1.130.0030.00319.09
8.1.120.0000.00717.68
8.1.110.0030.00517.59
8.1.100.0000.00717.66
8.1.90.0040.00417.74
8.1.80.0050.00517.65
8.1.70.0030.00517.57
8.1.60.0080.00017.81
8.1.50.0060.00317.73
8.1.40.0000.00817.71
8.1.30.0050.00317.76
8.1.20.0080.00017.89
8.1.10.0000.00817.82
8.1.00.0040.00417.61
8.0.300.0040.00419.82
8.0.290.0080.00017.00
8.0.280.0040.00418.58
8.0.270.0030.00317.50
8.0.260.0060.00016.97
8.0.250.0020.00517.12
8.0.240.0040.00417.24
8.0.230.0000.00717.07
8.0.220.0000.00817.07
8.0.210.0030.00317.02
8.0.200.0060.00017.19
8.0.190.0060.00317.16
8.0.180.0040.00417.13
8.0.170.0000.00817.10
8.0.160.0040.00417.02
8.0.150.0000.00717.02
8.0.140.0050.00216.99
8.0.130.0000.00613.50
8.0.120.0080.00017.04
8.0.110.0030.00516.93
8.0.100.0000.00717.10
8.0.90.0040.00417.05
8.0.80.0070.01017.00
8.0.70.0050.00316.93
8.0.60.0000.00717.10
8.0.50.0000.00717.13
8.0.30.0100.00817.17
8.0.20.0100.00917.43
8.0.10.0000.00717.04
8.0.00.0100.00716.77
7.4.330.0040.00415.55
7.4.320.0040.00416.79
7.4.300.0000.00716.70
7.4.290.0030.00316.61
7.4.280.0030.00616.70
7.4.270.0040.00416.73
7.4.260.0040.00416.57
7.4.250.0030.00516.59
7.4.240.0030.00416.69
7.4.230.0030.00316.71
7.4.220.0070.01116.80
7.4.210.0070.01016.79
7.4.200.0040.00416.91
7.4.160.0080.00816.80
7.4.150.0090.00917.40
7.4.140.0110.01017.86
7.4.130.0090.00916.87
7.4.120.0050.01516.79
7.4.110.0140.00316.75
7.4.100.0150.00816.57
7.4.90.0090.00916.86
7.4.80.0060.01119.39
7.4.70.0140.00316.74
7.4.60.0070.01116.72
7.4.50.0030.01016.56
7.4.40.0130.00916.58
7.4.30.0130.00316.81
7.4.00.0030.01315.06
7.3.330.0000.00513.45
7.3.320.0050.00013.34
7.3.310.0070.00016.55
7.3.300.0030.00316.48
7.3.290.0000.00716.36
7.3.280.0100.00516.52
7.3.270.0170.00017.40
7.3.260.0070.01416.80
7.3.250.0070.01116.55
7.3.240.0100.01216.55
7.3.230.0050.01416.83
7.3.210.0130.00316.66
7.3.200.0060.01016.87
7.3.190.0110.00416.75
7.3.180.0040.01416.56
7.3.170.0100.00716.48
7.3.160.0160.00616.70
7.2.330.0090.00917.01
7.2.320.0200.01716.66
7.2.310.0150.00317.03
7.2.300.0090.01316.66
7.2.290.0120.00516.85
7.2.60.0030.01016.88
7.2.00.0030.00919.74
7.1.200.0060.00615.70
7.1.100.0030.01018.36
7.1.70.0000.01417.06
7.1.60.0260.01835.24
7.1.50.0270.01234.82
7.1.40.0260.01334.51
7.1.30.0260.01534.57
7.1.20.0280.01434.64
7.1.10.0090.01116.89
7.1.00.0070.01316.95
7.0.200.0040.01316.92
7.0.190.0060.01216.98
7.0.180.0150.00716.20
7.0.170.0030.01616.39
7.0.160.0140.00516.31
7.0.150.0080.01116.30
7.0.140.0080.00816.35
7.0.130.0090.00716.72
7.0.120.0120.00316.59
7.0.110.0080.00916.59
7.0.100.0080.01416.43
7.0.90.0140.00916.33
7.0.80.0100.01016.43
7.0.70.0150.00616.61
7.0.60.0060.01416.36
7.0.50.0160.00616.46
7.0.40.0060.00916.51
7.0.30.0110.00416.54
7.0.20.0100.01316.44
7.0.10.0040.01516.53
7.0.00.0030.01316.54

preferences:
44.86 ms | 401 KiB | 5 Q