3v4l.org

run code in 300+ PHP versions simultaneously
<?php class XML { public function __CONSTRUCT($array) { foreach($array as $key => $val) { if(isset($key) && $key) { $this->$key = (object) null; $obj = $this->$val; $this->$val = $obj->bindTo($this->$key, $this->$val); } else { $this->$val = (object) null; $obj = $this->$val; $this->$val = $obj->bindTo($this->$val, $this->$val); } } } } $array = ["database"=>["host"=>"localhost","dbname"=>"mydb","user"=>"root","password"=>""]]; $xml = new XML($array); echo($xml->{"database"}->{"host"});
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pkFsc
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array, !1 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   19     1        NEW                                              $3      'XML'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   20     5        FETCH_OBJ_R                                      ~6      !1, 'database'
          6        FETCH_OBJ_R                                      ~7      ~6, 'host'
          7        ECHO                                                     ~7
          8      > RETURN                                                   1

Class XML:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 40
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 40
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/pkFsc
function name:  __CONSTRUCT
number of ops:  42
compiled vars:  !0 = $array, !1 = $val, !2 = $key, !3 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1      > FE_RESET_R                                       $4      !0, ->40
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->40
          3    >   ASSIGN                                                   !2, ~5
    5     4        ISSET_ISEMPTY_CV                                 ~7      !2
          5      > JMPZ_EX                                          ~7      ~7, ->7
          6    >   BOOL                                             ~7      !2
          7    > > JMPZ                                                     ~7, ->24
    6     8    >   CAST                                          8  ~9      null
          9        ASSIGN_OBJ                                               !2
         10        OP_DATA                                                  ~9
    7    11        FETCH_OBJ_R                                      ~10     !1
         12        ASSIGN                                                   !3, ~10
    8    13        INIT_METHOD_CALL                                         !3, 'bindTo'
         14        CHECK_FUNC_ARG                                           
         15        FETCH_OBJ_FUNC_ARG                               $13     !2
         16        SEND_FUNC_ARG                                            $13
         17        CHECK_FUNC_ARG                                           
         18        FETCH_OBJ_FUNC_ARG                               $14     !1
         19        SEND_FUNC_ARG                                            $14
         20        DO_FCALL                                      0  $15     
         21        ASSIGN_OBJ                                               !1
         22        OP_DATA                                                  $15
         23      > JMP                                                      ->39
   11    24    >   CAST                                          8  ~17     null
         25        ASSIGN_OBJ                                               !1
         26        OP_DATA                                                  ~17
   12    27        FETCH_OBJ_R                                      ~18     !1
         28        ASSIGN                                                   !3, ~18
   13    29        INIT_METHOD_CALL                                         !3, 'bindTo'
         30        CHECK_FUNC_ARG                                           
         31        FETCH_OBJ_FUNC_ARG                               $21     !1
         32        SEND_FUNC_ARG                                            $21
         33        CHECK_FUNC_ARG                                           
         34        FETCH_OBJ_FUNC_ARG                               $22     !1
         35        SEND_FUNC_ARG                                            $22
         36        DO_FCALL                                      0  $23     
         37        ASSIGN_OBJ                                               !1
         38        OP_DATA                                                  $23
    4    39    > > JMP                                                      ->2
         40    >   FE_FREE                                                  $4
   16    41      > RETURN                                                   null

End of function __construct

End of class XML.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.22 ms | 1403 KiB | 13 Q