3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xml2array ( $xmlObject, $out = array () ) { foreach ( (array) $xmlObject as $index => $node ) $out[$index] = ( is_object ( $node ) ) ? xml2array ( $node ) : $node; return $out; } $xml = <<<xml <?xml version="1.0" encoding="utf-8"?> <RESPONSE> <e></e> <e1> </e1> <e2> s </e2> <e3>s</e3> <e4> </e4> </RESPONSE> xml; $simpleXmlObj = simplexml_load_string($xml); $response = xml2array($simpleXmlObj); print_r($response);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0rhCF
function name:  (null)
number of ops:  13
compiled vars:  !0 = $xml, !1 = $simpleXmlObj, !2 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3CRESPONSE%3E%0A++%3Ce%3E%3C%2Fe%3E%0A++%3Ce1%3E++%3C%2Fe1%3E%0A++%3Ce2%3E+s+%3C%2Fe2%3E%0A++%3Ce3%3Es%3C%2Fe3%3E%0A++%3Ce4%3E%0A++%3C%2Fe4%3E%0A%3C%2FRESPONSE%3E'
   24     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   25     5        INIT_FCALL                                               'xml2array'
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !2, $6
   26     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

End of function xml2array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.34 ms | 1407 KiB | 18 Q