3v4l.org

run code in 300+ 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.4.20.0130.00721.66
8.4.10.0310.00517.99
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.260.0150.00316.89
8.2.250.0150.00316.90

preferences:
33.12 ms | 406 KiB | 6 Q