3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private static function bar($t) { var_dump ($t);} } $ref= (new ReflectionMethod('ReflectionMethod', 'invokeArgs'))->getClosure(); $closure = function () use ($ref) { var_dump(get_called_class()); $closure = (new ReflectionMethod('Foo', 'bar'))->getClosure(); $closure(null, [2]); }; $closure = $closure->bindTo(null, 'Foo'); $closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/guiJ0
function name:  (null)
number of ops:  18
compiled vars:  !0 = $ref, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'ReflectionMethod'
          2        SEND_VAL_EX                                              'invokeArgs'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $2, 'getClosure'
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !0, $4
    9     7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FguiJ0%3A9%240'
          8        BIND_LEXICAL                                             ~6, !0
          9        ASSIGN                                                   !1, ~6
   14    10        INIT_METHOD_CALL                                         !1, 'bindTo'
         11        SEND_VAL_EX                                              null
         12        SEND_VAL_EX                                              'Foo'
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                                   !1, $8
   15    15        INIT_DYNAMIC_CALL                                        !1
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FguiJ0%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/guiJ0
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $ref, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        INIT_FCALL                                               'var_dump'
          2        GET_CALLED_CLASS                                 ~2      
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                                 
   11     5        NEW                                              $4      'ReflectionMethod'
          6        SEND_VAL_EX                                              'Foo'
          7        SEND_VAL_EX                                              'bar'
          8        DO_FCALL                                      0          
          9        INIT_METHOD_CALL                                         $4, 'getClosure'
         10        DO_FCALL                                      0  $6      
         11        ASSIGN                                                   !1, $6
   12    12        INIT_DYNAMIC_CALL                                        !1
         13        SEND_VAL_EX                                              null
         14        SEND_VAL_EX                                              <array>
         15        DO_FCALL                                      0          
   13    16      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FguiJ0%3A9%240

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/guiJ0
function name:  bar
number of ops:  5
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
          4      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.7 ms | 1400 KiB | 15 Q