3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml=simplexml_load_string(<<<XML <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> </element> XML ); function deleteNode($feed_id) { global $xml; $node=$xml->xpath('//feed[@id=" '.$feed_id.' "]'); $node=dom_import_simplexml($node[0]); $parent=$node->parentNode; $parent->removeChild($node); $xml=simplexml_import_dom($parent->ownerDocument); } echo $xml->asXML(); echo "\n"; deleteNode("9"); echo $xml->asXML();

preferences:
45.88 ms | 402 KiB | 5 Q