3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<root> <parent> <child name='Child1'><a href=\"aaaa\">AAA</a></child> <child name='Child2'>BBBB</child> <subparent> <child name='Child3'>CCCC</child> </subparent> </parent> <child name='Child4'>DDDD</child> </root>"; $xml = simplexml_load_string( $xml); foreach( $xml->xpath( './/child[position() = 1]') as $child) { echo $child->asXML(). "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/XkmOh
function name:  (null)
number of ops:  17
compiled vars:  !0 = $xml, !1 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Croot%3E%0A++++%3Cparent%3E%0A%3Cchild+name%3D%27Child1%27%3E%3Ca+href%3D%22aaaa%22%3EAAA%3C%2Fa%3E%3C%2Fchild%3E%0A%3Cchild+name%3D%27Child2%27%3EBBBB%3C%2Fchild%3E%0A++++++++%3Csubparent%3E%0A++++++++++++%3Cchild+name%3D%27Child3%27%3ECCCC%3C%2Fchild%3E%0A++++++++%3C%2Fsubparent%3E%0A++++%3C%2Fparent%3E%0A++++%3Cchild+name%3D%27Child4%27%3EDDDD%3C%2Fchild%3E%0A%3C%2Froot%3E'
   13     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   15     5        INIT_METHOD_CALL                                         !0, 'xpath'
          6        SEND_VAL_EX                                              '.%2F%2Fchild%5Bposition%28%29+%3D+1%5D'
          7        DO_FCALL                                      0  $5      
          8      > FE_RESET_R                                       $6      $5, ->15
          9    > > FE_FETCH_R                                               $6, !1, ->15
   16    10    >   INIT_METHOD_CALL                                         !1, 'asXML'
         11        DO_FCALL                                      0  $7      
         12        CONCAT                                           ~8      $7, '%0A'
         13        ECHO                                                     ~8
   15    14      > JMP                                                      ->9
         15    >   FE_FREE                                                  $6
   17    16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
272.41 ms | 1395 KiB | 15 Q