3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private $data; private $relations; public function __set($name, $value) { $this->data[$name] = $value; } public function __get($name) { if(isset($this->data[$name])){ return $this->data[$name]; } } public function __construct() { $this->data = ['foo' => 'test', 'body' => 'content']; } public function test() { $function = debug_backtrace()[1]['function']; $this->data[$function] = ['a' =>'aa', 'b' =>'bb']; return $this; } } class bar extends foo{ public function aa(){ return $this->test(); } } $bar = new bar(); echo $bar->foo; $a = $bar->aa()->aa; echo $a['a']; print_r($bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  (null)
number of ops:  15
compiled vars:  !0 = $bar, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   NEW                                              $2      'bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   47     3        FETCH_OBJ_R                                      ~5      !0, 'foo'
          4        ECHO                                                     ~5
   48     5        INIT_METHOD_CALL                                         !0, 'aa'
          6        DO_FCALL                                      0  $6      
          7        FETCH_OBJ_R                                      ~7      $6, 'aa'
          8        ASSIGN                                                   !1, ~7
   49     9        FETCH_DIM_R                                      ~9      !1, 'a'
         10        ECHO                                                     ~9
   50    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class foo:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  __set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        FETCH_OBJ_W                                      $2      'data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   12     5      > RETURN                                                   null

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  __get
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        FETCH_OBJ_IS                                     ~1      'data'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->7
   17     4    >   FETCH_OBJ_R                                      ~3      'data'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6      > RETURN                                                   ~4
   19     7    > > RETURN                                                   null

End of function __get

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN_OBJ                                               'data'
          1        OP_DATA                                                  <array>
   24     2      > RETURN                                                   null

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  test
number of ops:  11
compiled vars:  !0 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $1      
          2        FETCH_DIM_R                                      ~2      $1, 1
          3        FETCH_DIM_R                                      ~3      ~2, 'function'
          4        ASSIGN                                                   !0, ~3
   29     5        FETCH_OBJ_W                                      $5      'data'
          6        ASSIGN_DIM                                               $5, !0
          7        OP_DATA                                                  <array>
   30     8        FETCH_THIS                                       ~7      
          9      > RETURN                                                   ~7
   32    10*     > RETURN                                                   null

End of function test

End of class foo.

Class bar:
Function aa:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  aa
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   INIT_METHOD_CALL                                         'test'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   41     3*     > RETURN                                                   null

End of function aa

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  __set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        FETCH_OBJ_W                                      $2      'data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   12     5      > RETURN                                                   null

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  __get
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        FETCH_OBJ_IS                                     ~1      'data'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, !0
          3      > JMPZ                                                     ~2, ->7
   17     4    >   FETCH_OBJ_R                                      ~3      'data'
          5        FETCH_DIM_R                                      ~4      ~3, !0
          6      > RETURN                                                   ~4
   19     7    > > RETURN                                                   null

End of function __get

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN_OBJ                                               'data'
          1        OP_DATA                                                  <array>
   24     2      > RETURN                                                   null

End of function __construct

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIKe4
function name:  test
number of ops:  11
compiled vars:  !0 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $1      
          2        FETCH_DIM_R                                      ~2      $1, 1
          3        FETCH_DIM_R                                      ~3      ~2, 'function'
          4        ASSIGN                                                   !0, ~3
   29     5        FETCH_OBJ_W                                      $5      'data'
          6        ASSIGN_DIM                                               $5, !0
          7        OP_DATA                                                  <array>
   30     8        FETCH_THIS                                       ~7      
          9      > RETURN                                                   ~7
   32    10*     > RETURN                                                   null

End of function test

End of class bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.43 ms | 1396 KiB | 17 Q