3v4l.org

run code in 300+ PHP versions simultaneously
<?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 $xml; $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();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jZa5O
function name:  (null)
number of ops:  9
compiled vars:  !0 = $data, !1 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%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'
   38     1        ECHO                                                     '%0A'
   39     2        INIT_FCALL                                               'deletenode'
          3        SEND_VAL                                                 '10'
          4        DO_FCALL                                      0          
   40     5        INIT_METHOD_CALL                                         !1, 'asXML'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Function deletenode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/jZa5O
function name:  deleteNode
number of ops:  23
compiled vars:  !0 = $feed_id, !1 = $xml, !2 = $doc, !3 = $data, !4 = $feed, !5 = $dom
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   29     1        BIND_GLOBAL                                              !1, 'xml'
   30     2        NEW                                              $6      'SimpleXMLElement'
          3        SEND_VAR_EX                                              !3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $6
   31     6        FETCH_OBJ_R                                      ~9      !2, 'feed'
          7      > FE_RESET_R                                       $10     ~9, ->21
          8    > > FE_FETCH_R                                               $10, !4, ->21
   32     9    >   FETCH_DIM_R                                      ~11     !4, 'id'
         10        IS_EQUAL                                                 !0, ~11
         11      > JMPZ                                                     ~12, ->20
   33    12    >   INIT_FCALL                                               'dom_import_simplexml'
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !5, $13
   34    16        FETCH_OBJ_R                                      ~15     !5, 'parentNode'
         17        INIT_METHOD_CALL                                         ~15, 'removeChild'
         18        SEND_VAR_EX                                              !5
         19        DO_FCALL                                      0          
   31    20    > > JMP                                                      ->8
         21    >   FE_FREE                                                  $10
   37    22      > RETURN                                                   null

End of function deletenode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.53 ms | 1403 KiB | 16 Q