3v4l.org

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

Class FooBar:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uB05E
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'I%27m+Dead%21%21%21'
          2        DO_ICALL                                                 
    8     3      > RETURN                                                   null

End of function __destruct

End of class FooBar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
225.06 ms | 1396 KiB | 15 Q