3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = '<!DOCTYPE html> <title>Valid HTML5 Document</title> <p>Paragraph 1</p> <script>console.log("</html>Console log text");</script> <p>Paragraph 2</p>'; // DOM/HTMLDocument (lexbor) $newDom = \DOM\HTMLDocument::createFromString($html); $paragraphs = $newDom->getElementsByTagName('p'); echo "\n"; echo "DOM\HTMLDocument parsing (lexbor)\n"; echo "---------------------------------\n"; echo "{$paragraphs->length} paragraph elements found.\n"; // 2 paragraphs found (correct) foreach ($paragraphs as $p) { echo " * " . trim($p->textContent) . "\n"; } echo "\n"; echo "DOM serialised:\n"; echo $newDom->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.30.0120.00818.22
8.5.20.0110.00620.42
8.5.10.0120.00817.08
8.5.00.0140.01220.54
8.4.180.0200.00921.07
8.4.170.0130.00924.16
8.4.160.0080.00424.07
8.4.150.0070.00517.15
8.4.140.0140.00817.91
8.4.130.0120.00918.19
8.4.120.0150.00520.46
8.4.110.0270.00718.50
8.4.100.0120.00918.88
8.4.90.0080.00821.05
8.4.80.0100.00418.86
8.4.70.0230.01218.95
8.4.60.0120.01018.81
8.4.50.0210.00818.81
8.4.40.0200.00617.95
8.4.30.0090.00920.96
8.4.20.0190.00618.44
8.4.10.0250.00618.14
8.3.300.0120.00820.94
8.3.290.0130.00720.87
8.3.280.0120.01118.35
8.3.270.0120.00716.54
8.3.260.0130.00716.21
8.3.250.0110.00818.81
8.3.240.0030.00816.47
8.3.230.0130.00616.77
8.3.220.0080.00618.80
8.3.210.0120.00916.84
8.3.200.0040.00516.75
8.3.190.0050.00316.61
8.3.180.0100.00816.83
8.3.170.0100.00618.39
8.3.160.0110.00717.12
8.3.150.0140.00417.16
8.3.140.0110.00716.44
8.3.130.0110.00716.77
8.3.50.0070.01116.59
8.2.300.0120.00818.18
8.2.290.0120.00820.61
8.2.280.0110.00918.86
8.2.270.0100.00718.79
8.2.260.0150.00316.89
8.2.250.0150.00316.90
8.1.340.0100.00917.70
8.1.320.0110.00916.16
7.4.320.0160.01116.23
7.1.120.0160.00815.00
5.6.400.0130.00815.49
4.3.00.0030.00214.66

preferences:
56.21 ms | 712 KiB | 5 Q