3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar() { } } function foo() { return $this; } $reflection2 = new \ReflectionFunction((new \ReflectionFunction(__NAMESPACE__ . '\\foo'))->getClosure()->bindTo(new \stdClass())); //$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 = 26, Position 2 = 51
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 51
Branch analysis from position: 27
2 jumps found. (Code = 46) Position 1 = 31, Position 2 = 35
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 50
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 50
Branch analysis from position: 35
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
filename:       /in/RZcZF
function name:  (null)
number of ops:  53
compiled vars:  !0 = $reflection2, !1 = $ReflectionClass, !2 = $ReflectionCeption, !3 = $Method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $4      'ReflectionFunction'
          1        NEW                                              $5      'ReflectionFunction'
          2        SEND_VAL_EX                                              '%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
         10        DO_FCALL                                      0  $10     
         11        SEND_VAR_NO_REF_EX                                       $10
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $4
   25    14        ECHO                                                     '%0A'
   26    15        ECHO                                                     '%0A'
   27    16        GET_CLASS                                        ~13     !0
         17        ASSIGN                                                   !1, ~13
   28    18        NEW                                              $15     'ReflectionClass'
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !2, $15
   29    22        INIT_METHOD_CALL                                         !2, 'getMethods'
         23        SEND_VAL_EX                                              1
         24        DO_FCALL                                      0  $18     
         25      > FE_RESET_R                                       $19     $18, ->51
         26    > > FE_FETCH_R                                               $19, !3, ->51
   30    27    >   INIT_METHOD_CALL                                         !3, 'isStatic'
         28        DO_FCALL                                      0  $20     
         29        BOOL_NOT                                         ~21     $20
         30      > JMPZ_EX                                          ~21     ~21, ->35
         31    >   INIT_METHOD_CALL                                         !3, 'getNumberOfParameters'
         32        DO_FCALL                                      0  $22     
         33        IS_IDENTICAL                                     ~23     $22, 0
         34        BOOL                                             ~21     ~23
         35    > > JMPZ                                                     ~21, ->50
   31    36    >   INIT_FCALL                                               'sprintf'
         37        SEND_VAL                                                 '%25s%3A%3A%25s%28%29%3A+'
         38        SEND_VAR                                                 !1
         39        FETCH_OBJ_R                                      ~24     !3, 'name'
         40        SEND_VAL                                                 ~24
         41        DO_ICALL                                         $25     
         42        ECHO                                                     $25
   32    43        INIT_FCALL                                               'var_dump'
         44        INIT_METHOD_CALL                                         !3, 'invoke'
         45        SEND_VAR_EX                                              !0
         46        DO_FCALL                                      0  $26     
         47        SEND_VAR                                                 $26
         48        DO_ICALL                                                 
   33    49        ECHO                                                     '%0A'
   29    50    > > JMP                                                      ->26
         51    >   FE_FREE                                                  $19
   35    52      > RETURN                                                   1

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

End of function foo

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

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.98 ms | 1400 KiB | 17 Q