3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <desc> These are the <special>&lt;best&gt;</special> chocolate chip cookies <special>&lt;EVER&gt;</special> </desc> XML; $sx = new SimpleXMLElement($xml); $dom = dom_import_simplexml($sx); $html = ''; foreach($dom->childNodes as $node) { switch($node->nodeType) { case XML_ELEMENT_NODE: if($node->tagName=='special') $html .= '<em>'.htmlspecialchars($node->textContent).'</em>'; break; case XML_TEXT_NODE: $html .= htmlspecialchars($node->data); break; } } echo trim($html);
Output for 8.1.31 - 8.1.33, 8.2.25 - 8.2.29, 8.3.5 - 8.3.28, 8.4.1 - 8.4.14, 8.4.16, 8.5.0 - 8.5.1
These are the <em>&lt;best&gt;</em> chocolate chip cookies <em>&lt;EVER&gt;</em>
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
53.46 ms | 407 KiB | 5 Q