3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<?xml version="1.0"?> <response><error code="0" message="" details=""></error><data><item id="12266824" subscriberid="47218" faxtype="0" listid="157750" fileid="858352" filename="" proprity="1" jobstatus="7" filetosend="RF20160912043659_1651144_sb47218.docx" faxnumber="83466727822" attempts="1" attemptsdone="" delay="5" nextattemptstart="2016-09-12 16:36" assigntochanel="-1" tifffilepages="1" notifyonok="0" notify="0" notifyemail="" isdialext="0" dialextval="" dialexttimeout="0" msgsend="0" arrlist="Array" schid="" priority="1"></item></data></response>'; //echo print_r(json_decode(json_encode((array) simplexml_load_string($xml)), 1), 1); function xml2array($xmlObject, $out = array()) { foreach ((array) $xmlObject as $index => $node) $out[$index . 'pref'] = ( is_object($node) ) ? xml2array($node) : $node; return $out; } echo print_r(xml2array(simplexml_load_string($xml)), 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AYqeQ
function name:  (null)
number of ops:  13
compiled vars:  !0 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Cresponse%3E%3Cerror+code%3D%220%22+message%3D%22%22+details%3D%22%22%3E%3C%2Ferror%3E%3Cdata%3E%3Citem+id%3D%2212266824%22+subscriberid%3D%2247218%22+faxtype%3D%220%22+listid%3D%22157750%22+fileid%3D%22858352%22+filename%3D%22%22+proprity%3D%221%22+jobstatus%3D%227%22+filetosend%3D%22RF20160912043659_1651144_sb47218.docx%22+faxnumber%3D%2283466727822%22+attempts%3D%221%22+attemptsdone%3D%22%22+delay%3D%225%22+nextattemptstart%3D%222016-09-12+16%3A36%22+assigntochanel%3D%22-1%22+tifffilepages%3D%221%22+notifyonok%3D%220%22+notify%3D%220%22+notifyemail%3D%22%22+isdialext%3D%220%22+dialextval%3D%22%22+dialexttimeout%3D%220%22+msgsend%3D%220%22+arrlist%3D%22Array%22+schid%3D%22%22+priority%3D%221%22%3E%3C%2Fitem%3E%3C%2Fdata%3E%3C%2Fresponse%3E'
   14     1        INIT_FCALL                                               'print_r'
          2        INIT_FCALL                                               'xml2array'
          3        INIT_FCALL                                               'simplexml_load_string'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        SEND_VAR                                                 $2
          7        DO_FCALL                                      0  $3      
          8        SEND_VAR                                                 $3
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $4      
         11        ECHO                                                     $4
         12      > RETURN                                                   1

Function xml2array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/AYqeQ
function name:  xml2array
number of ops:  21
compiled vars:  !0 = $xmlObject, !1 = $out, !2 = $node, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    9     2        CAST                                          7  ~4      !0
          3      > FE_RESET_R                                       $5      ~4, ->18
          4    > > FE_FETCH_R                                       ~6      $5, !2, ->18
          5    >   ASSIGN                                                   !3, ~6
   10     6        CONCAT                                           ~8      !3, 'pref'
          7        TYPE_CHECK                                  256          !2
          8      > JMPZ                                                     ~10, ->14
          9    >   INIT_FCALL_BY_NAME                                       'xml2array'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0  $11     
         12        QM_ASSIGN                                        ~12     $11
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~12     !2
         15    >   ASSIGN_DIM                                               !1, ~8
         16        OP_DATA                                                  ~12
    9    17      > JMP                                                      ->4
         18    >   FE_FREE                                                  $5
   12    19      > RETURN                                                   !1
   13    20*     > RETURN                                                   null

End of function xml2array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.29 ms | 1019 KiB | 16 Q