3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class B extends A { static function foo() { echo static::class, ' in ', self::class, PHP_EOL; } } $obj = new B; $obj->foo(); $closure = (new ReflectionMethod('B', 'foo'))->getClosure(null)->bindTo(null, A::class); $closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qiiEn
function name:  (null)
number of ops:  20
compiled vars:  !0 = $obj, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
   13     5        NEW                                              $6      'ReflectionMethod'
          6        SEND_VAL_EX                                              'B'
          7        SEND_VAL_EX                                              'foo'
          8        DO_FCALL                                      0          
          9        INIT_METHOD_CALL                                         $6, 'getClosure'
         10        SEND_VAL_EX                                              null
         11        DO_FCALL                                      0  $8      
         12        INIT_METHOD_CALL                                         $8, 'bindTo'
         13        SEND_VAL_EX                                              null
         14        SEND_VAL_EX                                              'A'
         15        DO_FCALL                                      0  $9      
         16        ASSIGN                                                   !1, $9
   14    17        INIT_DYNAMIC_CALL                                        !1
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Class A: [no user functions]
Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qiiEn
function name:  foo
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CLASS_NAME                                 ~0      
          1        ECHO                                                     ~0
          2        ECHO                                                     '+in+'
          3        ECHO                                                     'B'
          4        ECHO                                                     '%0A'
    8     5      > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.1 ms | 1394 KiB | 13 Q