3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xmlstring=<<<XML <?xml version="1.0" encoding="utf-8"?> <v-ov version="1.0"> <object vk="1" model="top"> <field type="BigIntegerField" name="bolpo">678</field> <field name="pdop"> <object wk="1" model="stage"> <field type="DateTimeField" name="updated_on">10 Dec, 2020, 10:00 </field> </object> <object wk="2" model="stage"> <field type="DateTimeField" name="updated_on">11 Dec, 2020, 10:00 </field> </object> </field> </object> </v-ov> XML; $xml_obj = new SimpleXMLElement($xmlstring); $nodes = $xml_obj->xpath('//object[@model="top"]/field[@name="pdop"]/object'); foreach($nodes as $node) { print_r($node); //attributes $model = $node['model']; $wk = $node['wk']; //node $field = $node->field; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/MUL4o
function name:  (null)
number of ops:  23
compiled vars:  !0 = $xmlstring, !1 = $xml_obj, !2 = $nodes, !3 = $node, !4 = $model, !5 = $wk, !6 = $field
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Cv-ov+version%3D%221.0%22%3E%0A%3Cobject+vk%3D%221%22+model%3D%22top%22%3E%0A%3Cfield+type%3D%22BigIntegerField%22+name%3D%22bolpo%22%3E678%3C%2Ffield%3E%0A%3Cfield+name%3D%22pdop%22%3E%0A%3Cobject+wk%3D%221%22+model%3D%22stage%22%3E%0A%3Cfield+type%3D%22DateTimeField%22+name%3D%22updated_on%22%3E10+Dec%2C+2020%2C+10%3A00+%3C%2Ffield%3E%0A%3C%2Fobject%3E%0A%3Cobject+wk%3D%222%22+model%3D%22stage%22%3E%0A%3Cfield+type%3D%22DateTimeField%22+name%3D%22updated_on%22%3E11+Dec%2C+2020%2C+10%3A00+%3C%2Ffield%3E%0A%3C%2Fobject%3E%0A%3C%2Ffield%3E%0A%3C%2Fobject%3E%0A%3C%2Fv-ov%3E'
   20     1        NEW                                                  $8      'SimpleXMLElement'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !1, $8
   21     5        INIT_METHOD_CALL                                             !1, 'xpath'
          6        SEND_VAL_EX                                                  '%2F%2Fobject%5B%40model%3D%22top%22%5D%2Ffield%5B%40name%3D%22pdop%22%5D%2Fobject'
          7        DO_FCALL                                          0  $11     
          8        ASSIGN                                                       !2, $11
   22     9      > FE_RESET_R                                           $13     !2, ->21
         10    > > FE_FETCH_R                                                   $13, !3, ->21
   23    11    >   INIT_FCALL                                                   'print_r'
         12        SEND_VAR                                                     !3
         13        DO_ICALL                                                     
   26    14        FETCH_DIM_R                                          ~15     !3, 'model'
         15        ASSIGN                                                       !4, ~15
   27    16        FETCH_DIM_R                                          ~17     !3, 'wk'
         17        ASSIGN                                                       !5, ~17
   30    18        FETCH_OBJ_R                                          ~19     !3, 'field'
         19        ASSIGN                                                       !6, ~19
   22    20      > JMP                                                          ->10
         21    >   FE_FREE                                                      $13
   32    22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174 ms | 1516 KiB | 14 Q