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 \ReflectionMethod(__NAMESPACE__ . '\\Foo', 'bar'))->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 = 32, Position 2 = 59
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 59
Branch analysis from position: 33
2 jumps found. (Code = 46) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 58
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 58
Branch analysis from position: 41
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
filename:       /in/mrSTX
function name:  (null)
number of ops:  61
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      'ReflectionMethod'
          2        SEND_VAL_EX                                              'Name%5CSpace%5CFoo'
          3        SEND_VAL_EX                                              'bar'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         $5, 'getClosure'
          6        DO_FCALL                                      0  $7      
          7        INIT_METHOD_CALL                                         $7, 'bindTo'
          8        NEW                                              $8      'stdClass'
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $8
   19    11        SEND_VAL_EX                                              'Name%5CSpace%5Cfoo'
         12        DO_FCALL                                      0  $10     
         13        SEND_VAR_NO_REF_EX                                       $10
         14        DO_FCALL                                      0          
   18    15        ASSIGN                                                   !0, $4
   27    16        FETCH_CONSTANT                                   ~13     'Name%5CSpace%5CPHP_EOL'
         17        ECHO                                                     ~13
   28    18        FETCH_CONSTANT                                   ~14     'Name%5CSpace%5CPHP_EOL'
         19        ECHO                                                     ~14
   29    20        INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Cget_class'
         21        SEND_VAR_EX                                              !0
         22        DO_FCALL                                      0  $15     
         23        ASSIGN                                                   !1, $15
   30    24        NEW                                              $17     'ReflectionClass'
         25        SEND_VAR_EX                                              !1
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !2, $17
   31    28        INIT_METHOD_CALL                                         !2, 'getMethods'
         29        SEND_VAL_EX                                              1
         30        DO_FCALL                                      0  $20     
         31      > FE_RESET_R                                       $21     $20, ->59
         32    > > FE_FETCH_R                                               $21, !3, ->59
   32    33    >   INIT_METHOD_CALL                                         !3, 'isStatic'
         34        DO_FCALL                                      0  $22     
         35        BOOL_NOT                                         ~23     $22
         36      > JMPZ_EX                                          ~23     ~23, ->41
         37    >   INIT_METHOD_CALL                                         !3, 'getNumberOfParameters'
         38        DO_FCALL                                      0  $24     
         39        IS_IDENTICAL                                     ~25     $24, 0
         40        BOOL                                             ~23     ~25
         41    > > JMPZ                                                     ~23, ->58
   33    42    >   INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Csprintf'
         43        SEND_VAL_EX                                              '%25s%3A%3A%25s%28%29%3A+'
         44        SEND_VAR_EX                                              !1
         45        CHECK_FUNC_ARG                                           
         46        FETCH_OBJ_FUNC_ARG                               $26     !3, 'name'
         47        SEND_FUNC_ARG                                            $26
         48        DO_FCALL                                      0  $27     
         49        ECHO                                                     $27
   34    50        INIT_NS_FCALL_BY_NAME                                    'Name%5CSpace%5Cvar_dump'
         51        INIT_METHOD_CALL                                         !3, 'invoke'
         52        SEND_VAR_EX                                              !0
         53        DO_FCALL                                      0  $28     
         54        SEND_VAR_NO_REF_EX                                       $28
         55        DO_FCALL                                      0          
   35    56        FETCH_CONSTANT                                   ~30     'Name%5CSpace%5CPHP_EOL'
         57        ECHO                                                     ~30
   31    58    > > JMP                                                      ->32
         59    >   FE_FREE                                                  $21
   37    60      > RETURN                                                   1

Function name%5Cspace%5Cfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mrSTX
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/mrSTX
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:
170.27 ms | 1400 KiB | 19 Q