3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $p = '<p>I am <strong>Bold</strong>!</p>'; $dom = new \DOMDocument( '1.0', 'UTF-8' ); $dom->loadXML( "<content>{$p}</content>" ); $list = $dom->getElementsByTagName( 'p' ); $node = $list->item( 0 ); echo $dom->saveXML( $node->textContent );
based on 0OV59
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode or null, string given in /in/QhhUO:10 Stack trace: #0 /in/QhhUO(10): DOMDocument->saveXML('I am Bold!') #1 {main} thrown in /in/QhhUO on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode, string given in /in/QhhUO:10 Stack trace: #0 /in/QhhUO(10): DOMDocument->saveXML('I am Bold!') #1 {main} thrown in /in/QhhUO on line 10
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Catchable fatal error: Argument 1 passed to DOMDocument::saveXML() must be an instance of DOMNode, string given in /in/QhhUO on line 10
Process exited with code 255.