3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">10</int> <lst name="params"> <str name="q">*:*</str> <str name="facet.field">main</str> <str name="facet.mincount">1</str> <str name="rows">0</str> <str name="facet">on</str> </lst> </lst> <lst name="responseHeader"> <int name="status">1</int> <int name="QTime">11</int> <lst name="params"> <str name="q">*:*</str> <str name="facet.field">main</str> <str name="facet.mincount">1</str> <str name="rows">0</str> <str name="facet">on</str> </lst> </lst> <result name="response" numFound="5473" start="0"/> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"> <lst name="main"> <int name="Victoria University Photograph Collection">1693</int> </lst> </lst> </lst> </response> XML; $input = simplexml_load_string($xml); $items = $input->xpath('/response/lst//*'); $arr = []; foreach ($items as $item) { if (isset($item->attributes()->name) && trim((string)$item) !== "") { $arr[] = [(string)$item->attributes()->name => (string)$item]; } } print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 32
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 31
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 31
Branch analysis from position: 22
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/SvgKK
function name:  (null)
number of ops:  37
compiled vars:  !0 = $xml, !1 = $input, !2 = $items, !3 = $arr, !4 = $item
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%3Cresponse%3E%0A++++%3Clst+name%3D%22responseHeader%22%3E%0A++++++++%3Cint+name%3D%22status%22%3E0%3C%2Fint%3E%0A++++++++%3Cint+name%3D%22QTime%22%3E10%3C%2Fint%3E%0A++++++++%3Clst+name%3D%22params%22%3E%0A++++++++++++%3Cstr+name%3D%22q%22%3E%2A%3A%2A%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22facet.field%22%3Emain%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22facet.mincount%22%3E1%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22rows%22%3E0%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22facet%22%3Eon%3C%2Fstr%3E%0A++++++++%3C%2Flst%3E%0A++++%3C%2Flst%3E%0A+++++%3Clst+name%3D%22responseHeader%22%3E%0A++++++++%3Cint+name%3D%22status%22%3E1%3C%2Fint%3E%0A++++++++%3Cint+name%3D%22QTime%22%3E11%3C%2Fint%3E%0A++++++++%3Clst+name%3D%22params%22%3E%0A++++++++++++%3Cstr+name%3D%22q%22%3E%2A%3A%2A%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22facet.field%22%3Emain%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22facet.mincount%22%3E1%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22rows%22%3E0%3C%2Fstr%3E%0A++++++++++++%3Cstr+name%3D%22facet%22%3Eon%3C%2Fstr%3E%0A++++++++%3C%2Flst%3E%0A++++%3C%2Flst%3E%0A++++%3Cresult+name%3D%22response%22+numFound%3D%225473%22+start%3D%220%22%2F%3E%0A++++%3Clst+name%3D%22facet_counts%22%3E%0A++++++++%3Clst+name%3D%22facet_queries%22%2F%3E%0A++++++++%3Clst+name%3D%22facet_fields%22%3E%0A++++++++++++%3Clst+name%3D%22main%22%3E%0A++++++++++++++++%3Cint+name%3D%22Victoria+University+Photograph+Collection%22%3E1693%3C%2Fint%3E%0A++++++++++++%3C%2Flst%3E%0A++++++++%3C%2Flst%3E%0A++++%3C%2Flst%3E%0A%3C%2Fresponse%3E'
   40     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   42     5        INIT_METHOD_CALL                                         !1, 'xpath'
          6        SEND_VAL_EX                                              '%2Fresponse%2Flst%2F%2F%2A'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   43     9        ASSIGN                                                   !3, <array>
   44    10      > FE_RESET_R                                       $11     !2, ->32
         11    > > FE_FETCH_R                                               $11, !4, ->32
   45    12    >   INIT_METHOD_CALL                                         !4, 'attributes'
         13        DO_FCALL                                      0  $12     
         14        ISSET_ISEMPTY_PROP_OBJ                           ~13     $12, 'name'
         15      > JMPZ_EX                                          ~13     ~13, ->22
         16    >   INIT_FCALL                                               'trim'
         17        CAST                                          6  ~14     !4
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                         $15     
         20        IS_NOT_IDENTICAL                                 ~16     $15, ''
         21        BOOL                                             ~13     ~16
         22    > > JMPZ                                                     ~13, ->31
   46    23    >   INIT_METHOD_CALL                                         !4, 'attributes'
         24        DO_FCALL                                      0  $18     
         25        FETCH_OBJ_R                                      ~19     $18, 'name'
         26        CAST                                          6  ~20     ~19
         27        CAST                                          6  ~21     !4
         28        INIT_ARRAY                                       ~22     ~21, ~20
         29        ASSIGN_DIM                                               !3
         30        OP_DATA                                                  ~22
   44    31    > > JMP                                                      ->11
         32    >   FE_FREE                                                  $11
   49    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.24 ms | 1012 KiB | 16 Q