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) $key; $this->$val = (object) $val; $this->$val = $val->bindTo($this->$key); } else { $this->$val = (object) $val; $this->$val = $val->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/4R3Q5
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array, !1 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   18     1        NEW                                              $3      'XML'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   19     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 = 36
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 36
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 = 22
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 7
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/4R3Q5
function name:  __CONSTRUCT
number of ops:  38
compiled vars:  !0 = $array, !1 = $val, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1      > FE_RESET_R                                       $3      !0, ->36
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->36
          3    >   ASSIGN                                                   !2, ~4
    5     4        ISSET_ISEMPTY_CV                                 ~6      !2
          5      > JMPZ_EX                                          ~6      ~6, ->7
          6    >   BOOL                                             ~6      !2
          7    > > JMPZ                                                     ~6, ->22
    6     8    >   CAST                                          8  ~8      !2
          9        ASSIGN_OBJ                                               !2
         10        OP_DATA                                                  ~8
    7    11        CAST                                          8  ~10     !1
         12        ASSIGN_OBJ                                               !1
         13        OP_DATA                                                  ~10
    8    14        INIT_METHOD_CALL                                         !1, 'bindTo'
         15        CHECK_FUNC_ARG                                           
         16        FETCH_OBJ_FUNC_ARG                               $12     !2
         17        SEND_FUNC_ARG                                            $12
         18        DO_FCALL                                      0  $13     
         19        ASSIGN_OBJ                                               !1
         20        OP_DATA                                                  $13
         21      > JMP                                                      ->35
   11    22    >   CAST                                          8  ~15     !1
         23        ASSIGN_OBJ                                               !1
         24        OP_DATA                                                  ~15
   12    25        INIT_METHOD_CALL                                         !1, 'bindTo'
         26        CHECK_FUNC_ARG                                           
         27        FETCH_OBJ_FUNC_ARG                               $17     !1
         28        SEND_FUNC_ARG                                            $17
         29        CHECK_FUNC_ARG                                           
         30        FETCH_OBJ_FUNC_ARG                               $18     !1
         31        SEND_FUNC_ARG                                            $18
         32        DO_FCALL                                      0  $19     
         33        ASSIGN_OBJ                                               !1
         34        OP_DATA                                                  $19
    4    35    > > JMP                                                      ->2
         36    >   FE_FREE                                                  $3
   15    37      > RETURN                                                   null

End of function __construct

End of class XML.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.18 ms | 1399 KiB | 13 Q