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 = new DOMDocument('1.0', 'UTF-8'); $dom->formatOutput = true; $dom->loadHtml($html); $paragraphs = $dom->getElementsByTagName('p'); echo "DOMDocument parsing (libxml)\n"; echo "----------------------------\n"; echo "{$paragraphs->length} paragraph elements found:\n"; // 3 paragraphs found but we expected 2 foreach ($paragraphs as $p) { echo " * " . trim($p->textContent) . "\n"; } echo "\n"; echo "DOM serialised:\n"; 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.4.20.0110.00019.75
8.4.10.0180.00818.94
8.3.150.0120.00617.56
8.3.140.0290.00516.94
8.3.130.0070.01117.13
8.3.50.0040.01417.15
8.2.260.0230.00716.94
8.2.250.0130.00616.90

preferences:
39.16 ms | 403 KiB | 5 Q