3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOD <li id="" class="menu-item-has-children"> <a href="https://example.com">Parent Menu Item</a> <!-- Add button HTML element here --> <ul class="sub-menu"> <!-- Child menu items --> </ul> </li> EOD; $doc = new DOMDocument(); $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($doc); foreach ($xpath->query('//li[@class="menu-item-has-children"]/a') as $a) { $button = $doc->createElement('button', 'Your button text'); // modify button as required // ... // add to document $a->parentNode->insertBefore($button, $a->nextSibling); } echo $doc->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.130.0100.00918.20
8.4.120.0130.00420.98
8.4.110.0130.00818.84
8.4.100.0130.00518.96
8.4.90.0070.00320.87
8.4.80.0130.00919.21
8.4.70.0050.00418.11
8.4.60.0140.00621.06
8.4.50.0110.00820.76
8.4.40.0130.00620.20
8.4.30.0070.01319.30
8.4.20.0120.00818.38
8.4.10.0090.00022.52
8.3.250.0080.01019.18
8.3.240.0090.00716.79
8.3.230.0120.00716.93
8.3.220.0110.00819.21
8.3.210.0060.00116.98
8.3.200.0050.00416.77
8.3.190.0050.00417.55
8.3.180.0110.00816.87
8.3.170.0060.00317.31
8.3.160.0090.00916.89
8.3.150.0120.00617.63
8.3.140.0000.00817.61
8.3.130.0040.00418.53
8.3.120.0100.00020.71
8.3.110.0000.01018.55
8.3.100.0130.00316.97
8.3.90.0080.00026.77
8.3.80.0060.00316.88
8.3.70.0110.00716.88
8.3.60.0130.00618.77
8.3.50.0110.00720.32
8.3.40.0100.00320.54
8.3.30.0110.00419.09
8.3.20.0070.00024.18
8.3.10.0030.00624.66
8.3.00.0000.00826.16
8.2.290.0110.00621.08
8.2.280.0030.00619.29
8.2.270.0060.01216.73
8.2.260.0040.00419.21
8.2.250.0150.00417.52
8.2.240.0060.00321.16
8.2.230.0060.00320.94
8.2.220.0040.01124.06
8.2.210.0070.01026.77
8.2.200.0090.00018.82
8.2.190.0040.01517.00
8.2.180.0080.00825.92
8.2.170.0150.00319.21
8.2.160.0100.00722.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00326.16
8.2.120.0090.00621.35
8.2.110.0030.00719.49
8.2.100.0080.00418.00
8.2.90.0040.00419.64
8.2.80.0050.00318.00
8.2.70.0090.00017.88
8.2.60.0000.00918.18
8.2.50.0050.00318.07
8.2.40.0050.00318.41
8.2.30.0070.00018.29
8.2.20.0050.00319.67
8.2.10.0040.00418.46
8.2.00.0000.00819.56
8.1.330.0080.00316.51
8.1.320.0110.00816.80
8.1.310.0060.01217.24
8.1.300.0030.00616.43
8.1.290.0000.01030.84
8.1.280.0100.01025.92
8.1.270.0030.00524.66
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00024.13
8.1.230.0040.00718.03
8.1.220.0000.00818.02
8.1.210.0030.00518.77
8.1.200.0060.00317.61
8.1.190.0000.00817.85
8.1.180.0060.00318.10
8.1.170.0080.00019.08
8.1.160.0000.00719.24
8.1.150.0000.00818.89
8.1.140.0000.00717.78
8.1.130.0030.00319.32
8.1.120.0000.00717.87
8.1.110.0040.00417.87
8.1.100.0010.00717.74
8.1.90.0100.00617.71
8.1.80.0080.00817.73
8.1.70.0160.00017.71
8.1.60.0130.00617.75
8.1.50.0090.00917.86
8.1.40.0160.00317.78
8.1.30.0160.00317.94
8.1.20.0160.00317.92
8.1.10.0110.00717.93
8.1.00.0180.00017.90
8.0.300.0070.00018.77
8.0.290.0050.00217.25
8.0.280.0000.00718.79
8.0.270.0030.00317.23
8.0.260.0000.00618.80
8.0.250.0070.00017.27
8.0.240.0030.00317.35
8.0.230.0110.00317.31
8.0.220.0090.00617.25
8.0.210.0140.00017.25
8.0.200.0130.00217.21
8.0.190.0090.00617.31
8.0.180.0130.00317.15
8.0.170.0070.00717.11
8.0.160.0050.00917.22
8.0.150.0130.00217.20
8.0.140.0080.00817.17
8.0.130.0070.00717.11
8.0.120.0100.00517.25
8.0.110.0120.00417.21
8.0.100.0170.00017.26
8.0.90.0170.00017.19
8.0.80.0090.00617.17
8.0.70.0150.00017.19
8.0.60.0170.00017.14
8.0.50.0150.00017.19
8.0.30.0090.00617.29
8.0.20.0120.00317.23
8.0.10.0090.00517.38
7.4.330.0050.00015.55
7.4.320.0000.00616.78
7.4.300.0110.00616.98
7.4.290.0060.00916.84
7.4.280.0080.00616.94
7.4.270.0080.00516.71
7.4.260.0090.00616.83
7.4.250.0060.00616.85
7.4.240.0090.00416.89
7.4.230.0110.00316.92
7.4.220.0040.00716.71
7.4.210.0070.00716.78
7.4.200.0120.00216.93
7.4.190.0070.00716.97
7.4.180.0080.00816.89
7.4.160.0120.00316.93
7.4.150.0110.00516.77
7.4.140.0090.00616.74
7.4.130.0160.00016.92
7.4.120.0090.00616.80
7.4.110.0130.00316.74
7.4.100.0160.00016.77
7.4.90.0130.00316.80
7.4.80.0070.00716.86
7.4.70.0100.00716.66
7.4.60.0140.00016.74
7.4.50.0100.00216.61
7.4.40.0090.00316.38
7.4.30.0090.00316.70
7.4.20.0060.00616.56
7.4.10.0090.00416.71
7.4.00.0140.00016.77

preferences:
32.23 ms | 403 KiB | 5 Q