3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Name\Space; class Foo { public static function bar() { } } $reflection = new \ReflectionMethod('Name\\Space\\Foo', 'bar'); $closure = $reflection->getClosure(null); $reflection2 = new \ReflectionFunction($closure); var_dump($reflection2->getClosureScopeClass ()->getName()); $reflection3 = new \ReflectionFunction(function () {}); var_dump($closure, $reflection, $reflection2, $reflection3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FYZu9
function name:  (null)
number of ops:  32
compiled vars:  !0 = $reflection, !1 = $closure, !2 = $reflection2, !3 = $reflection3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $4      'ReflectionMethod'
          1        SEND_VAL_EX                                              'Name%5CSpace%5CFoo'
          2        SEND_VAL_EX                                              'bar'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   14     5        INIT_METHOD_CALL                                         !0, 'getClosure'
          6        SEND_VAL_EX                                              null
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !1, $7
   15     9        NEW                                              $9      'ReflectionFunction'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $9
   16    13        INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Cvar_dump'
         14        INIT_METHOD_CALL                                         !2, 'getClosureScopeClass'
         15        DO_FCALL                                      0  $12     
         16        INIT_METHOD_CALL                                         $12, 'getName'
         17        DO_FCALL                                      0  $13     
         18        SEND_VAR_NO_REF_EX                                       $13
         19        DO_FCALL                                      0          
   17    20        NEW                                              $15     'ReflectionFunction'
         21        DECLARE_LAMBDA_FUNCTION                                  '%00name%5Cspace%5C%7Bclosure%7D%2Fin%2FFYZu9%3A17%240'
         22        SEND_VAL_EX                                              ~16
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !3, $15
   19    25        INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Cvar_dump'
         26        SEND_VAR_EX                                              !1
         27        SEND_VAR_EX                                              !0
         28        SEND_VAR_EX                                              !2
         29        SEND_VAR_EX                                              !3
         30        DO_FCALL                                      0          
         31      > RETURN                                                   1

Function %00name%5Cspace%5C%7Bclosure%7D%2Fin%2FFYZu9%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FYZu9
function name:  Name\Space\{closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   null

End of function %00name%5Cspace%5C%7Bclosure%7D%2Fin%2FFYZu9%3A17%240

Class Name\Space\Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FYZu9
function name:  bar
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E > > RETURN                                                   null

End of function bar

End of class Name\Space\Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.69 ms | 1400 KiB | 15 Q