3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml=simplexml_load_string(<<<XML <?xml version="1.0"?> <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> XML ); function deleteNode($feed_id) { global $xml; $parent=$xml->xpath('feed[@id="'.$feed_id.'"]'); unset($parent[0]->{0}); } echo "\n"; deleteNode("10"); echo $xml->asXML();
based on H4cFl
Output for 5.0.0 - 7.1.0
<?xml version="1.0"?> <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>
Output for 4.3.3 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Property name must be a string in /in/tHElt on line 34
Process exited with code 255.
Output for 4.4.2
Fatal error: Property name must be a string in /in/tHElt on line 35
Process exited with code 255.
Output for 4.3.2
Fatal error: Call to undefined function: simplexml_load_string() in /in/tHElt on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: simplexml_load_string() in /in/tHElt on line 2