3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DudenResponse { protected $response; public function __construct($response) { $this->response = $response; $this ->stripShit() ->decode() ->mockXML(); } protected function stripShit() { $this->response = substr($this->response, 36-1); return $this; } protected function decode() { $response = preg_replace("/\\\\u([0-9a-f]{3,4})/i", "&#x\\1;", $this->response); $this->response = html_entity_decode($response, null, 'UTF-8'); return $this; } protected function mockXML() { $this->response = str_replace([ '<?dpf ', ' ?>', '?>' ], [ '<', '>', '>' ], $this->response); return $this; } public function toArray() { $xml = simplexml_load_string($this->toString()); $array = []; foreach ($xml as $node) { $array[(string) $node] = explode(';', $node->attributes()['prop']); } return $array; } public function toString() { return $this->response; } public function __toString() { return $this->toString(); } } $response = "0;78d13qqoglyszmorspfwfdmwffgnubgr;\u003c?dpf sent len=\"1\"?\u003e\u003c?dpf orth code=\"unknown\" prop=\"Lesen;Lehnen;Lehren;Leasen;Leisen\" ?\u003elehsen\u003c?dpf /orth ?\u003e\u003c?dpf /sent ?\u003e"; /*$response = preg_replace("/\\\\u([0-9a-f]{3,4})/i", "&#x\\1;", $response); $response = html_entity_decode($response , null, 'UTF-8'); $response = str_replace([ '<?dpf ', ' ?>', '?>' ], [ '<', '>', '>' ], $response); $response = substr($response, 36-1);*/ $response = new DudenResponse($response); echo $response; echo "\n\n-----\n\n"; print_r($response->toArray());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  (null)
number of ops:  14
compiled vars:  !0 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'dudenresponse'
   60     1        ASSIGN                                                   !0, '0%3B78d13qqoglyszmorspfwfdmwffgnubgr%3B%5Cu003c%3Fdpf+sent+len%3D%221%22%3F%5Cu003e%5Cu003c%3Fdpf+orth+code%3D%22unknown%22+prop%3D%22Lesen%3BLehnen%3BLehren%3BLeasen%3BLeisen%22+%3F%5Cu003elehsen%5Cu003c%3Fdpf+%2Forth+%3F%5Cu003e%5Cu003c%3Fdpf+%2Fsent+%3F%5Cu003e'
   67     2        NEW                                              $2      'DudenResponse'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   69     6        ECHO                                                     !0
   70     7        ECHO                                                     '%0A%0A-----%0A%0A'
   72     8        INIT_FCALL                                               'print_r'
          9        INIT_METHOD_CALL                                         !0, 'toArray'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class DudenResponse:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  __construct
number of ops:  10
compiled vars:  !0 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'response'
          2        OP_DATA                                                  !0
   10     3        INIT_METHOD_CALL                                         'stripShit'
          4        DO_FCALL                                      0  $2      
   11     5        INIT_METHOD_CALL                                         $2, 'decode'
          6        DO_FCALL                                      0  $3      
   12     7        INIT_METHOD_CALL                                         $3, 'mockXML'
          8        DO_FCALL                                      0          
   13     9      > RETURN                                                   null

End of function __construct

Function stripshit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  stripShit
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'substr'
          1        FETCH_OBJ_R                                      ~1      'response'
          2        SEND_VAL                                                 ~1
          3        SEND_VAL                                                 35
          4        DO_ICALL                                         $2      
          5        ASSIGN_OBJ                                               'response'
          6        OP_DATA                                                  $2
   19     7        FETCH_THIS                                       ~3      
          8      > RETURN                                                   ~3
   20     9*     > RETURN                                                   null

End of function stripshit

Function decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  decode
number of ops:  17
compiled vars:  !0 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'preg_replace'
          1        SEND_VAL                                                 '%2F%5C%5Cu%28%5B0-9a-f%5D%7B3%2C4%7D%29%2Fi'
          2        SEND_VAL                                                 '%26%23x%5C1%3B'
          3        FETCH_OBJ_R                                      ~1      'response'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
   25     7        INIT_FCALL                                               'html_entity_decode'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 null
         10        SEND_VAL                                                 'UTF-8'
         11        DO_ICALL                                         $5      
         12        ASSIGN_OBJ                                               'response'
         13        OP_DATA                                                  $5
   27    14        FETCH_THIS                                       ~6      
         15      > RETURN                                                   ~6
   28    16*     > RETURN                                                   null

End of function decode

Function mockxml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  mockXML
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'str_replace'
          1        SEND_VAL                                                 <array>
          2        SEND_VAL                                                 <array>
          3        FETCH_OBJ_R                                      ~1      'response'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                         $2      
          6        ASSIGN_OBJ                                               'response'
          7        OP_DATA                                                  $2
   34     8        FETCH_THIS                                       ~3      
          9      > RETURN                                                   ~3
   35    10*     > RETURN                                                   null

End of function mockxml

Function toarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/vl4ZL
function name:  toArray
number of ops:  23
compiled vars:  !0 = $xml, !1 = $array, !2 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   INIT_FCALL                                               'simplexml_load_string'
          1        INIT_METHOD_CALL                                         'toString'
          2        DO_FCALL                                      0  $3      
          3        SEND_VAR                                                 $3
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
   40     6        ASSIGN                                                   !1, <array>
   42     7      > FE_RESET_R                                       $7      !0, ->20
          8    > > FE_FETCH_R                                               $7, !2, ->20
   43     9    >   CAST                                          6  ~8      !2
         10        INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '%3B'
         12        INIT_METHOD_CALL                                         !2, 'attributes'
         13        DO_FCALL                                      0  $10     
         14        FETCH_DIM_R                                      ~11     $10, 'prop'
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        ASSIGN_DIM                                               !1, ~8
         18        OP_DATA                                                  $12
   42    19      > JMP                                                      ->8
         20    >   FE_FREE                                                  $7
   46    21      > RETURN                                                   !1
   47    22*     > RETURN                                                   null

End of function toarray

Function tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   FETCH_OBJ_R                                      ~0      'response'
          1      > RETURN                                                   ~0
   52     2*     > RETURN                                                   null

End of function tostring

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vl4ZL
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   INIT_METHOD_CALL                                         'toString'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   57     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

End of class DudenResponse.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.89 ms | 1404 KiB | 27 Q