3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { public function __get($name): string { var_dump(__METHOD__); print_r(array_map(fn ($v) => $v['function'], debug_backtrace())); return '=' . $name; } } class Model { use T { T::__get as private __t_get; } public function __get($name): string { var_dump(__METHOD__); return $this->__t_get($name); } } class X extends Model {} class Y extends Model { public function __get($name): string { var_dump(__METHOD__); return parent::__get($name); } } class Z extends Model { private function __x_get($name): string { var_dump(__METHOD__); return parent::__get($name); } public function __get($name): string { var_dump(__METHOD__); return $this->__x_get($name); } } class P extends Model { private function __t_get($name): string { var_dump(__METHOD__); return parent::__get($name); } public function __get($name): string { var_dump(__METHOD__); return $this->__t_get($name); } } $m = new X(); $m->a; echo "\n"; $m = new Y(); $m->a; echo "\n"; $m = new Z(); $m->a; echo "\n"; $m = new P(); $m->a;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  (null)
number of ops:  29
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'model'
   23     1        DECLARE_CLASS                                            'x', 'model'
   25     2        DECLARE_CLASS                                            'y', 'model'
   32     3        DECLARE_CLASS                                            'z', 'model'
   44     4        DECLARE_CLASS                                            'p', 'model'
   56     5        NEW                                              $1      'X'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $1
   57     8        FETCH_OBJ_R                                      ~4      !0, 'a'
          9        FREE                                                     ~4
   59    10        ECHO                                                     '%0A'
   61    11        NEW                                              $5      'Y'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $5
   62    14        FETCH_OBJ_R                                      ~8      !0, 'a'
         15        FREE                                                     ~8
   64    16        ECHO                                                     '%0A'
   66    17        NEW                                              $9      'Z'
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !0, $9
   67    20        FETCH_OBJ_R                                      ~12     !0, 'a'
         21        FREE                                                     ~12
   69    22        ECHO                                                     '%0A'
   71    23        NEW                                              $13     'P'
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !0, $13
   72    26        FETCH_OBJ_R                                      ~16     !0, 'a'
         27        FREE                                                     ~16
   73    28      > RETURN                                                   1

Class T:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __get
number of ops:  19
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'T%3A%3A__get'
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'print_r'
          5        INIT_FCALL                                               'array_map'
          6        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          7        SEND_VAL                                                 ~2
          8        INIT_FCALL                                               'debug_backtrace'
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                                 
    8    14        CONCAT                                           ~6      '%3D', !0
         15        VERIFY_RETURN_TYPE                                       ~6
         16      > RETURN                                                   ~6
    9    17*       VERIFY_RETURN_TYPE                                       
         18*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 'function'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 0

End of function __get

End of class T.

Class Model:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Model%3A%3A__get'
          3        DO_ICALL                                                 
   19     4        INIT_METHOD_CALL                                         '__t_get'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
   20     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __get

End of class Model.

Class X: [no user functions]
Class Y:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Y%3A%3A__get'
          3        DO_ICALL                                                 
   28     4        INIT_STATIC_METHOD_CALL                                  '__get'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
   29     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __get

End of class Y.

Class Z:
Function __x_get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __x_get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Z%3A%3A__x_get'
          3        DO_ICALL                                                 
   35     4        INIT_STATIC_METHOD_CALL                                  '__get'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
   36     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __x_get

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
   39     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Z%3A%3A__get'
          3        DO_ICALL                                                 
   40     4        INIT_METHOD_CALL                                         '__x_get'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
   41     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __get

End of class Z.

Class P:
Function __t_get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __t_get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   RECV                                             !0      
   46     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'P%3A%3A__t_get'
          3        DO_ICALL                                                 
   47     4        INIT_STATIC_METHOD_CALL                                  '__get'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
   48     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __t_get

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uVm7l
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
   51     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'P%3A%3A__get'
          3        DO_ICALL                                                 
   52     4        INIT_METHOD_CALL                                         '__t_get'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
   53     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __get

End of class P.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.62 ms | 1014 KiB | 17 Q