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 get() { return $this->response; } public function __toString() { return $this->get(); } } $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"; $xml = simplexml_load_string($response); foreach ($xml as $node) { echo $node . " => "; print_r(explode(';', $node->attributes()['prop'])); echo "\n\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 28
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/IJ3YJ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $response, !1 = $xml, !2 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'dudenresponse'
   48     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'
   55     2        NEW                                              $4      'DudenResponse'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $4
   57     6        ECHO                                                     !0
   58     7        ECHO                                                     '%0A%0A-----%0A%0A'
   60     8        INIT_FCALL                                               'simplexml_load_string'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !1, $7
   61    12      > FE_RESET_R                                       $9      !1, ->28
         13    > > FE_FETCH_R                                               $9, !2, ->28
   62    14    >   CONCAT                                           ~10     !2, '+%3D%3E+'
         15        ECHO                                                     ~10
   63    16        INIT_FCALL                                               'print_r'
         17        INIT_FCALL                                               'explode'
         18        SEND_VAL                                                 '%3B'
         19        INIT_METHOD_CALL                                         !2, 'attributes'
         20        DO_FCALL                                      0  $11     
         21        FETCH_DIM_R                                      ~12     $11, 'prop'
         22        SEND_VAL                                                 ~12
         23        DO_ICALL                                         $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                                 
   64    26        ECHO                                                     '%0A%0A'
   61    27      > JMP                                                      ->13
         28    >   FE_FREE                                                  $9
   65    29      > RETURN                                                   1

Class DudenResponse:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IJ3YJ
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/IJ3YJ
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/IJ3YJ
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/IJ3YJ
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 get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IJ3YJ
function name:  get
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   FETCH_OBJ_R                                      ~0      'response'
          1      > RETURN                                                   ~0
   40     2*     > RETURN                                                   null

End of function get

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IJ3YJ
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   INIT_METHOD_CALL                                         'get'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   45     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:
156.99 ms | 1404 KiB | 27 Q