3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><Body><Fault><Code><Value>SOAP-ENV:Receiver</Value></Code><Reason><Text>OMS login failure: Problem in OMS UAMS login - Nested Exception/Error: java.net.ConnectException: Tried all: \'1\' addresses, but could not connect over HTTP to server: \'nlut02hr\', port: \'40100\' </Text></Reason><Role>BEA</Role><Detail><error xmlns:bsl="http://com.amdocs.bss.bsl/"><errorCode>BSL-14002</errorCode><errorMessage>Generic exception returned from external system</errorMessage><detail><fault xmlns:con="http://www.bea.com/wli/sb/context"><errorCode>BEA-380000</errorCode><location><node>getAddOnsRouteNode</node><path>response-pipeline</path></location></fault></detail></error></Detail></Fault></Body></Envelope>' ; $xml = new SimpleXMLElement($str); foreach ($xml->getNamespaces(true) as $ns => $uri) { $str = str_replace(sprintf('%s:', $ns), '', $str); } $xml = new SimpleXMLElement($str); var_dump(objectToArray($xml)); function objectToArray($data) { if (is_object($data)) { $data = get_object_vars($data); } if (is_array($data)) { return array_map('objectToArray', $data); } else { return $data; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/sgsY5
function name:  (null)
number of ops:  34
compiled vars:  !0 = $str, !1 = $xml, !2 = $uri, !3 = $ns
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%3F%3E%0A%3CEnvelope+xmlns%3Asoap%3D%22http%3A%2F%2Fwww.w3.org%2F2003%2F05%2Fsoap-envelope%22%3E%3CBody%3E%3CFault%3E%3CCode%3E%3CValue%3ESOAP-ENV%3AReceiver%3C%2FValue%3E%3C%2FCode%3E%3CReason%3E%3CText%3EOMS+login+failure%3A+Problem+in+OMS+UAMS+login+-%0A++++Nested+Exception%2FError%3A%0A++++java.net.ConnectException%3A+Tried+all%3A+%271%27+addresses%2C+but+could+not+connect+over+HTTP+to+server%3A+%27nlut02hr%27%2C+port%3A+%2740100%27%0A%3C%2FText%3E%3C%2FReason%3E%3CRole%3EBEA%3C%2FRole%3E%3CDetail%3E%3Cerror+xmlns%3Absl%3D%22http%3A%2F%2Fcom.amdocs.bss.bsl%2F%22%3E%3CerrorCode%3EBSL-14002%3C%2FerrorCode%3E%3CerrorMessage%3EGeneric+exception+returned+from+external+system%3C%2FerrorMessage%3E%3Cdetail%3E%3Cfault+xmlns%3Acon%3D%22http%3A%2F%2Fwww.bea.com%2Fwli%2Fsb%2Fcontext%22%3E%3CerrorCode%3EBEA-380000%3C%2FerrorCode%3E%3Clocation%3E%3Cnode%3EgetAddOnsRouteNode%3C%2Fnode%3E%3Cpath%3Eresponse-pipeline%3C%2Fpath%3E%3C%2Flocation%3E%3C%2Ffault%3E%3C%2Fdetail%3E%3C%2Ferror%3E%3C%2FDetail%3E%3C%2FFault%3E%3C%2FBody%3E%3C%2FEnvelope%3E'
    8     1        NEW                                              $5      'SimpleXMLElement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
    9     5        INIT_METHOD_CALL                                         !1, 'getNamespaces'
          6        SEND_VAL_EX                                              <true>
          7        DO_FCALL                                      0  $8      
          8      > FE_RESET_R                                       $9      $8, ->22
          9    > > FE_FETCH_R                                       ~10     $9, !2, ->22
         10    >   ASSIGN                                                   !3, ~10
   10    11        INIT_FCALL                                               'str_replace'
         12        INIT_FCALL                                               'sprintf'
         13        SEND_VAL                                                 '%25s%3A'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $12     
         16        SEND_VAR                                                 $12
         17        SEND_VAL                                                 ''
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !0, $13
    9    21      > JMP                                                      ->9
         22    >   FE_FREE                                                  $9
   12    23        NEW                                              $15     'SimpleXMLElement'
         24        SEND_VAR_EX                                              !0
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !1, $15
   14    27        INIT_FCALL                                               'var_dump'
         28        INIT_FCALL_BY_NAME                                       'objectToArray'
         29        SEND_VAR_EX                                              !1
         30        DO_FCALL                                      0  $18     
         31        SEND_VAR                                                 $18
         32        DO_ICALL                                                 
   25    33      > RETURN                                                   1

Function objecttoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 15
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/sgsY5
function name:  objectToArray
number of ops:  17
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        TYPE_CHECK                                  256          !0
          2      > JMPZ                                                     ~1, ->7
   18     3    >   INIT_FCALL                                               'get_object_vars'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
   21     7    >   TYPE_CHECK                                  128          !0
          8      > JMPZ                                                     ~4, ->15
   22     9    >   INIT_FCALL                                               'array_map'
         10        SEND_VAL                                                 'objectToArray'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13      > RETURN                                                   $5
         14*       JMP                                                      ->16
   23    15    > > RETURN                                                   !0
   25    16*     > RETURN                                                   null

End of function objecttoarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.17 ms | 1392 KiB | 23 Q