3v4l.org

run code in 300+ PHP versions simultaneously
<?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]); } echo "\n"; deleteNode("10"); echo $xml->asXML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NGMtI
function name:  (null)
number of ops:  12
compiled vars:  !0 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'simplexml_load_string'
    3     1        SEND_VAL                                                 '%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Croot%3E%0A%09%3Celement%3E%0A++++%09%3Cfeed+id%3D%229%22%3E%0A++++++++%09%3Ctitle%3Etest%3C%2Ftitle%3E%0A++++++++%09%3Ctable%3Efeeds%3C%2Ftable%3E%0A++++++++%09%3Clink%2F%3E%0A++++++++%09%3Cfeed_type%3EAPI%3C%2Ffeed_type%3E%0A++++++++%09%3Caffiliate%2F%3E%0A++++++++%09%3Cmwst%3Eja%3C%2Fmwst%3E%0A++++++++%09%3Ctld%3EDE%3C%2Ftld%3E%0A++++++++%09%3Cquery%2F%3E%0A++++%09%3C%2Ffeed%3E%0A++++%09%3Cfeed+id%3D%2210%22%3E%0A++++++++%09%3Ctitle%3Etest%3C%2Ftitle%3E%0A++++++++%09%3Ctable%3Efeeds%3C%2Ftable%3E%0A++++++++%09%3Clink%2F%3E%0A++++++++%09%3Cfeed_type%3EAPI%3C%2Ffeed_type%3E%0A++++++++%09%3Caffiliate%2F%3E%0A++++++++%09%3Cmwst%3Eja%3C%2Fmwst%3E%0A++++++++%09%3Ctld%3EDE%3C%2Ftld%3E%0A++++++++%09%3Cquery%2F%3E%0A++++%09%3C%2Ffeed%3E%0A%09%3C%2Felement%3E%0A%3C%2Froot%3E'
          2        DO_ICALL                                         $1      
    2     3        ASSIGN                                                   !0, $1
   36     4        ECHO                                                     '%0A'
   37     5        INIT_FCALL                                               'deletenode'
          6        SEND_VAL                                                 '10'
          7        DO_FCALL                                      0          
   38     8        INIT_METHOD_CALL                                         !0, 'asXML'
          9        DO_FCALL                                      0  $4      
         10        ECHO                                                     $4
         11      > RETURN                                                   1

Function deletenode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NGMtI
function name:  deleteNode
number of ops:  10
compiled vars:  !0 = $feed_id, !1 = $xml, !2 = $parent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   32     1        BIND_GLOBAL                                              !1, 'xml'
   33     2        INIT_METHOD_CALL                                         !1, 'xpath'
          3        CONCAT                                           ~3      'feed%5B%40id%3D%22', !0
          4        CONCAT                                           ~4      ~3, '%22%5D'
          5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !2, $5
   34     8        UNSET_DIM                                                !2, 0
   35     9      > RETURN                                                   null

End of function deletenode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.62 ms | 1390 KiB | 16 Q