3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data=' <root> <element> <feed id="9"> <title>test</title> <table>feeds</table> <link/> <feed_type>API</feed_type> <affiliate/> <mwst>ja</mwst> <tld>DE</tld> <query/> </feed> <feed id="10"> <title>test</title> <table>feeds</table> <link/> <feed_type>API</feed_type> <affiliate/> <mwst>ja</mwst> <tld>DE</tld> <query/> </feed> </element> </root>'; function deleteNode($feed_id) { global $data; $doc = new SimpleXMLElement($data); foreach($doc->feed as $feed){ if($feed['id'] == $feed_id) { $dom=dom_import_simplexml($feed); $dom->parentNode->removeChild($dom); } } } echo "\n"; deleteNode("10"); echo $xml->asXML();
based on jZa5O
Output for 7.0.5 - 7.1.0
Notice: Undefined variable: xml in /in/5c70C on line 40 Fatal error: Uncaught Error: Call to a member function asXML() on null in /in/5c70C:40 Stack trace: #0 {main} thrown in /in/5c70C on line 40
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: xml in /in/5c70C on line 40 Fatal error: Uncaught Error: Call to a member function asXML() on unknown in /in/5c70C:40 Stack trace: #0 {main} thrown in /in/5c70C on line 40
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: xml in /in/5c70C on line 40 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function asXML() on a non-object (null)' in /in/5c70C:40 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: xml in /in/5c70C on line 40 Fatal error: Call to a member function asXML() on null in /in/5c70C on line 40
Process exited with code 255.
Output for 5.0.4 - 5.5.35
Notice: Undefined variable: xml in /in/5c70C on line 40 Fatal error: Call to a member function asXML() on a non-object in /in/5c70C on line 40
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: xml in /in/5c70C on line 40 Fatal error: Call to a member function asXML() on a non-object in /in/5c70C on line 40
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/5c70C on line 30
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/5c70C on line 30