3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function b() { echo static::class; } } class B extends A { } $c = ['B', 'b']; $d = \Closure::fromCallable($c); $r = new \ReflectionFunction($d); var_dump($r->getClosureScopeClass()); $d();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OpEA9
function name:  (null)
number of ops:  17
compiled vars:  !0 = $c, !1 = $d, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_STATIC_METHOD_CALL                                  'Closure', 'fromCallable'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !1, $4
   19     5        NEW                                              $6      'ReflectionFunction'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $6
   21     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !2, 'getClosureScopeClass'
         11        DO_FCALL                                      0  $9      
         12        SEND_VAR                                                 $9
         13        DO_ICALL                                                 
   23    14        INIT_DYNAMIC_CALL                                        !1
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Class A:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OpEA9
function name:  b
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CLASS_NAME                                 ~0      
          1        ECHO                                                     ~0
    8     2      > RETURN                                                   null

End of function b

End of class A.

Class B:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OpEA9
function name:  b
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CLASS_NAME                                 ~0      
          1        ECHO                                                     ~0
    8     2      > RETURN                                                   null

End of function b

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.67 ms | 1011 KiB | 14 Q