3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = <<<HTML <div class="content"> <h2>Hello World</h2> <p>This is a paragraph.</p> </div> HTML; libxml_use_internal_errors(true); $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors(); // Change the heading text $h2 = $dom->getElementsByTagName('h2')->item(0); $h2->nodeValue = 'Updated Heading'; // Add a class to the paragraph $p = $dom->getElementsByTagName('p')->item(0); $p->setAttribute('class', 'intro'); // Output the modified HTML echo $dom->saveHTML();<?php $html = <<<HTML <div class="content"> <h2>Hello World</h2> <p>This is a paragraph.</p> </div> HTML; libxml_use_internal_errors(true); $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors(); // Change the heading text $h2 = $dom->getElementsByTagName('h2')->item(0); $h2->nodeValue = 'Updated Heading'; // Add a class to the paragraph $p = $dom->getElementsByTagName('p')->item(0); $p->setAttribute('class', 'intro'); // Output the modified HTML 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.5.90.0260.00616.86
8.5.80.0280.00916.67
8.5.70.0270.00916.59
8.5.60.0360.00516.61
8.5.50.0300.01116.54
8.5.40.0300.00616.41
8.5.30.0290.00416.12
8.5.20.0270.00716.50
8.5.10.0210.00316.56
8.5.00.0070.00316.48
8.4.240.0050.00419.66
8.4.230.0170.00119.49
8.4.220.0160.00619.64
8.4.210.0170.00819.57
8.4.200.0210.01119.27
8.4.190.0150.00619.33
8.4.180.0130.00519.64
8.4.170.0160.00319.49
8.4.160.0140.00419.46
8.4.150.0140.00419.71
8.4.140.0130.00417.71
8.4.130.0120.00617.68
8.4.120.0140.00617.80
8.4.110.0190.00717.92
8.4.100.0170.00417.98
8.4.90.0180.00117.67
8.4.80.0220.00117.88
8.4.70.0190.00617.83
8.4.60.0120.00817.71
8.4.50.0140.00517.80
8.4.40.0190.00417.50
8.4.30.0160.00417.51
8.4.20.0170.00517.61
8.4.10.0260.00617.67
8.3.330.0140.00417.90
8.3.320.0120.00518.34
8.3.310.0150.00318.22
8.3.300.0120.00818.11
8.3.290.0150.00718.19
8.3.280.0170.00818.26
8.3.270.0280.00416.77
8.3.260.0150.00316.68
8.3.250.0170.00416.73
8.3.240.0130.00716.83
8.3.230.0170.00216.43
8.3.220.0160.00416.56
8.3.210.0200.00316.77
8.3.200.0190.00316.70
8.3.190.0180.00316.60
8.3.180.0170.00216.68
8.3.170.0160.00416.50
8.3.160.0170.00416.58
8.3.150.0170.00216.65
8.3.140.0160.00516.58
8.3.130.0140.00516.58
8.3.120.0140.00416.54
8.3.110.0130.00416.72
8.3.100.0170.00216.54
8.3.90.0160.00416.49
8.3.80.0160.00416.81
8.3.70.0180.00316.53
8.3.60.0170.00416.82
8.3.50.0170.00416.59
8.3.40.0200.00317.78
8.3.30.0100.00517.84
8.3.20.0130.00317.58
8.3.10.0110.00617.78
8.3.00.0160.00217.84
8.2.330.0160.00317.75
8.2.320.0140.00417.84
8.2.310.0130.00617.64

preferences:
51.12 ms | 786 KiB | 4 Q