3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Name\Space; class Foo { public static function bar() { } } function foo() { return $this; } $reflection2 = new \ReflectionFunction((new \ReflectionFunction(__NAMESPACE__ . '\\foo'))->getClosure()->bindTo(new \stdClass(), __NAMESPACE__ .'\\foo')); //$reflection = new \ReflectionMethod('Name\\Space\\Foo', 'bar'); //$closure = $reflection->getClosure(null); //$reflection2 = new \ReflectionFunction($closure); echo PHP_EOL; echo PHP_EOL; $ReflectionClass = get_class($reflection2); $ReflectionCeption = new \ReflectionClass($ReflectionClass); foreach ($ReflectionCeption->getMethods(\ReflectionMethod::IS_PUBLIC) as $Method) { if(!$Method->isStatic() && $Method->getNumberOfParameters() === 0) { echo sprintf('%s::%s(): ', $ReflectionClass, $Method->name); var_dump($Method->invoke($reflection2)); echo PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 58
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 58
Branch analysis from position: 32
2 jumps found. (Code = 46) Position 1 = 36, Position 2 = 40
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 57
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 57
Branch analysis from position: 40
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
filename:       /in/JITkF
function name:  (null)
number of ops:  60
compiled vars:  !0 = $reflection2, !1 = $ReflectionClass, !2 = $ReflectionCeption, !3 = $Method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $4      'ReflectionFunction'
          1        NEW                                              $5      'ReflectionFunction'
          2        SEND_VAL_EX                                              'Name%5CSpace%5Cfoo'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $5, 'getClosure'
          5        DO_FCALL                                      0  $7      
          6        INIT_METHOD_CALL                                         $7, 'bindTo'
          7        NEW                                              $8      'stdClass'
          8        DO_FCALL                                      0          
          9        SEND_VAR_NO_REF_EX                                       $8
   19    10        SEND_VAL_EX                                              'Name%5CSpace%5Cfoo'
         11        DO_FCALL                                      0  $10     
         12        SEND_VAR_NO_REF_EX                                       $10
         13        DO_FCALL                                      0          
   18    14        ASSIGN                                                   !0, $4
   27    15        FETCH_CONSTANT                                   ~13     'Name%5CSpace%5CPHP_EOL'
         16        ECHO                                                     ~13
   28    17        FETCH_CONSTANT                                   ~14     'Name%5CSpace%5CPHP_EOL'
         18        ECHO                                                     ~14
   29    19        INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Cget_class'
         20        SEND_VAR_EX                                              !0
         21        DO_FCALL                                      0  $15     
         22        ASSIGN                                                   !1, $15
   30    23        NEW                                              $17     'ReflectionClass'
         24        SEND_VAR_EX                                              !1
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !2, $17
   31    27        INIT_METHOD_CALL                                         !2, 'getMethods'
         28        SEND_VAL_EX                                              1
         29        DO_FCALL                                      0  $20     
         30      > FE_RESET_R                                       $21     $20, ->58
         31    > > FE_FETCH_R                                               $21, !3, ->58
   32    32    >   INIT_METHOD_CALL                                         !3, 'isStatic'
         33        DO_FCALL                                      0  $22     
         34        BOOL_NOT                                         ~23     $22
         35      > JMPZ_EX                                          ~23     ~23, ->40
         36    >   INIT_METHOD_CALL                                         !3, 'getNumberOfParameters'
         37        DO_FCALL                                      0  $24     
         38        IS_IDENTICAL                                     ~25     $24, 0
         39        BOOL                                             ~23     ~25
         40    > > JMPZ                                                     ~23, ->57
   33    41    >   INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Csprintf'
         42        SEND_VAL_EX                                              '%25s%3A%3A%25s%28%29%3A+'
         43        SEND_VAR_EX                                              !1
         44        CHECK_FUNC_ARG                                           
         45        FETCH_OBJ_FUNC_ARG                               $26     !3, 'name'
         46        SEND_FUNC_ARG                                            $26
         47        DO_FCALL                                      0  $27     
         48        ECHO                                                     $27
   34    49        INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Cvar_dump'
         50        INIT_METHOD_CALL                                         !3, 'invoke'
         51        SEND_VAR_EX                                              !0
         52        DO_FCALL                                      0  $28     
         53        SEND_VAR_NO_REF_EX                                       $28
         54        DO_FCALL                                      0          
   35    55        FETCH_CONSTANT                                   ~30     'Name%5CSpace%5CPHP_EOL'
         56        ECHO                                                     ~30
   31    57    > > JMP                                                      ->31
         58    >   FE_FREE                                                  $21
   37    59      > RETURN                                                   1

Function name%5Cspace%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JITkF
function name:  Name\Space\foo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_THIS                                       ~0      
          1      > RETURN                                                   ~0
   16     2*     > RETURN                                                   null

End of function name%5Cspace%5Cfoo

Class Name\Space\Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JITkF
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:
155.71 ms | 1400 KiB | 19 Q