3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {private $a=1;} class Bar { function test() { var_dump($this); } } $closure = (new \ReflectionMethod('Bar','test'))->getClosure(new Bar); $object = new Foo; $closure = $closure->bindTo($object, get_class($object)); var_dump($closure); $closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2iVon
function name:  (null)
number of ops:  25
compiled vars:  !0 = $closure, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'Bar'
          2        SEND_VAL_EX                                              'test'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $2, 'getClosure'
          5        NEW                                              $4      'Bar'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !0, $6
   12    10        NEW                                              $8      'Foo'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $8
   13    13        INIT_METHOD_CALL                                         !0, 'bindTo'
         14        SEND_VAR_EX                                              !1
         15        GET_CLASS                                        ~11     !1
         16        SEND_VAL_EX                                              ~11
         17        DO_FCALL                                      0  $12     
         18        ASSIGN                                                   !0, $12
   15    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   16    22        INIT_DYNAMIC_CALL                                        !0
         23        DO_FCALL                                      0          
         24      > RETURN                                                   1

Class Foo: [no user functions]
Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2iVon
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    9     4      > RETURN                                                   null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.41 ms | 1388 KiB | 15 Q