3v4l.org

run code in 300+ PHP versions simultaneously
<?php class BaseController { public static function init() { $r = new ReflectionClass(static::class); $methods = $r->getMethods(ReflectionMethod::IS_PUBLIC); $props = array_keys($r->getStaticProperties()); foreach ($methods as $method) { $prop = $method->name; if (in_array($prop, $props)) { static::$$prop = static::class . '@' . $method->name; } } } } class UserController extends BaseController { public static $get; public function get($id) { echo "Get: $id"; } } UserController::init(); echo UserController::$get;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BdnPc
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                  'UserController', 'init'
          1        DO_FCALL                                      0          
   28     2        FETCH_STATIC_PROP_R          unknown             ~1      'get'
          3        ECHO                                                     ~1
          4      > RETURN                                                   1

Class BaseController:
Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 31
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/BdnPc
function name:  init
number of ops:  33
compiled vars:  !0 = $r, !1 = $methods, !2 = $props, !3 = $method, !4 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $5      'ReflectionClass'
          1        FETCH_CLASS_NAME                                 ~6      
          2        SEND_VAL_EX                                              ~6
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
    6     5        INIT_METHOD_CALL                                         !0, 'getMethods'
          6        SEND_VAL_EX                                              1
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !1, $9
    7     9        INIT_FCALL                                               'array_keys'
         10        INIT_METHOD_CALL                                         !0, 'getStaticProperties'
         11        DO_FCALL                                      0  $11     
         12        SEND_VAR                                                 $11
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !2, $12
    8    15      > FE_RESET_R                                       $14     !1, ->31
         16    > > FE_FETCH_R                                               $14, !3, ->31
    9    17    >   FETCH_OBJ_R                                      ~15     !3, 'name'
         18        ASSIGN                                                   !4, ~15
   10    19        INIT_FCALL                                               'in_array'
         20        SEND_VAR                                                 !4
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $17     
         23      > JMPZ                                                     $17, ->30
   11    24    >   FETCH_CLASS_NAME                                 ~19     
         25        CONCAT                                           ~20     ~19, '%40'
         26        FETCH_OBJ_R                                      ~21     !3, 'name'
         27        CONCAT                                           ~22     ~20, ~21
         28        ASSIGN_STATIC_PROP                                       !4
         29        OP_DATA                                                  ~22
    8    30    > > JMP                                                      ->16
         31    >   FE_FREE                                                  $14
   14    32      > RETURN                                                   null

End of function init

End of class BaseController.

Class UserController:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BdnPc
function name:  get
number of ops:  5
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        NOP                                                      
          2        FAST_CONCAT                                      ~1      'Get%3A+', !0
          3        ECHO                                                     ~1
   23     4      > RETURN                                                   null

End of function get

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 31
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 30
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/BdnPc
function name:  init
number of ops:  33
compiled vars:  !0 = $r, !1 = $methods, !2 = $props, !3 = $method, !4 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $5      'ReflectionClass'
          1        FETCH_CLASS_NAME                                 ~6      
          2        SEND_VAL_EX                                              ~6
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
    6     5        INIT_METHOD_CALL                                         !0, 'getMethods'
          6        SEND_VAL_EX                                              1
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !1, $9
    7     9        INIT_FCALL                                               'array_keys'
         10        INIT_METHOD_CALL                                         !0, 'getStaticProperties'
         11        DO_FCALL                                      0  $11     
         12        SEND_VAR                                                 $11
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !2, $12
    8    15      > FE_RESET_R                                       $14     !1, ->31
         16    > > FE_FETCH_R                                               $14, !3, ->31
    9    17    >   FETCH_OBJ_R                                      ~15     !3, 'name'
         18        ASSIGN                                                   !4, ~15
   10    19        INIT_FCALL                                               'in_array'
         20        SEND_VAR                                                 !4
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $17     
         23      > JMPZ                                                     $17, ->30
   11    24    >   FETCH_CLASS_NAME                                 ~19     
         25        CONCAT                                           ~20     ~19, '%40'
         26        FETCH_OBJ_R                                      ~21     !3, 'name'
         27        CONCAT                                           ~22     ~20, ~21
         28        ASSIGN_STATIC_PROP                                       !4
         29        OP_DATA                                                  ~22
    8    30    > > JMP                                                      ->16
         31    >   FE_FREE                                                  $14
   14    32      > RETURN                                                   null

End of function init

End of class UserController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.32 ms | 1408 KiB | 17 Q