3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dom = new DomDocumentFragment(); $dom->loadHTML('<form class="search-form"> <meta itemprop="target"> <input type="search"> <input type="submit"> </form>'); $forms = $dom->getElementsByTagName('form'); $span = $dom->createElement('span', 'hello'); $forms->item(0)->appendChild($span); echo $dom->saveHTML();
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Call to undefined method DOMDocumentFragment::loadHTML() in /in/vJSsS:3 Stack trace: #0 {main} thrown in /in/vJSsS on line 3
Process exited with code 255.

preferences:
156.68 ms | 403 KiB | 179 Q