3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>'. '<request><body test2="321" test3="987">'. '<rows><my-row test4="564">'. '<types>'. '<custom>this is the example of the text</custom>'. '<Generic arch="simple">this is the example of the text</Generic>'. '<bold/><italic/><underlined/>'. '</types>'. '</my-row><my-row test5="565"/><test hidden="false" ready="true"/></rows>'. '</body></request>'; function f($xml){ $s = array(); foreach ($xml as $key => $value) { $s[$key] = null; if (count($value->attributes())) $s[$key]['attributes'] = $value->attributes(); if (is_string($value)) $s[$key]['content'] = $value; print_r(array( 'key' => $key, 'hasChildren' => (bool)$xml->hasChildren(), 'attributes' => $value->attributes(), 'stack' => $s, )); if (get_class($value) == 'SimpleXMLIterator') f($value); } return $s; } f(new SimpleXMLIterator($s));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X6V56
function name:  (null)
number of ops:  8
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22+standalone%3D%22yes%22+%3F%3E%3Crequest%3E%3Cbody+test2%3D%22321%22+test3%3D%22987%22%3E%3Crows%3E%3Cmy-row+test4%3D%22564%22%3E%3Ctypes%3E%3Ccustom%3Ethis+is+the+example+of+the+text%3C%2Fcustom%3E%3CGeneric+arch%3D%22simple%22%3Ethis+is+the+example+of+the+text%3C%2FGeneric%3E%3Cbold%2F%3E%3Citalic%2F%3E%3Cunderlined%2F%3E%3C%2Ftypes%3E%3C%2Fmy-row%3E%3Cmy-row+test5%3D%22565%22%2F%3E%3Ctest+hidden%3D%22false%22+ready%3D%22true%22%2F%3E%3C%2Frows%3E%3C%2Fbody%3E%3C%2Frequest%3E'
   33     1        INIT_FCALL                                               'f'
          2        NEW                                              $2      'SimpleXMLIterator'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $2
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 40
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 40
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 39
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 39
Branch analysis from position: 21
Branch analysis from position: 16
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/X6V56
function name:  f
number of ops:  43
compiled vars:  !0 = $xml, !1 = $s, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        ASSIGN                                                   !1, <array>
   15     2      > FE_RESET_R                                       $5      !0, ->40
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->40
          4    >   ASSIGN                                                   !3, ~6
   16     5        ASSIGN_DIM                                               !1, !3
          6        OP_DATA                                                  null
   17     7        INIT_METHOD_CALL                                         !2, 'attributes'
          8        DO_FCALL                                      0  $9      
          9        COUNT                                            ~10     $9
         10      > JMPZ                                                     ~10, ->16
   18    11    >   INIT_METHOD_CALL                                         !2, 'attributes'
         12        DO_FCALL                                      0  $13     
         13        FETCH_DIM_W                                      $11     !1, !3
         14        ASSIGN_DIM                                               $11, 'attributes'
         15        OP_DATA                                                  $13
   19    16    >   TYPE_CHECK                                   64          !2
         17      > JMPZ                                                     ~14, ->21
   20    18    >   FETCH_DIM_W                                      $15     !1, !3
         19        ASSIGN_DIM                                               $15, 'content'
         20        OP_DATA                                                  !2
   21    21    >   INIT_FCALL                                               'print_r'
   22    22        INIT_ARRAY                                       ~17     !3, 'key'
   23    23        INIT_METHOD_CALL                                         !0, 'hasChildren'
         24        DO_FCALL                                      0  $18     
         25        BOOL                                             ~19     $18
         26        ADD_ARRAY_ELEMENT                                ~17     ~19, 'hasChildren'
   24    27        INIT_METHOD_CALL                                         !2, 'attributes'
         28        DO_FCALL                                      0  $20     
         29        ADD_ARRAY_ELEMENT                                ~17     $20, 'attributes'
   25    30        ADD_ARRAY_ELEMENT                                ~17     !1, 'stack'
         31        SEND_VAL                                                 ~17
         32        DO_ICALL                                                 
   27    33        GET_CLASS                                        ~22     !2
         34        IS_EQUAL                                                 ~22, 'SimpleXMLIterator'
         35      > JMPZ                                                     ~23, ->39
         36    >   INIT_FCALL_BY_NAME                                       'f'
         37        SEND_VAR_EX                                              !2
         38        DO_FCALL                                      0          
   15    39    > > JMP                                                      ->3
         40    >   FE_FREE                                                  $5
   29    41      > RETURN                                                   !1
   30    42*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.19 ms | 1403 KiB | 16 Q