3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooBar { public function __destruct() { var_dump('I\'m Dead!!!'); } } $foo = new FooBar(); $getter = function () { return $this; }; $closure = $getter->bindTo($foo); $reflection = new ReflectionFunction($closure); unset($closure, $foo); //unset($reflection); var_dump('Unset!!!'); gc_collect_cycles(); //var_dump($reflection->getClosureThis()); var_dump('Done!!!');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KpCRM
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $getter, !2 = $closure, !3 = $reflection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $4      'FooBar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   12     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKpCRM%3A12%240'
          4        ASSIGN                                                   !1, ~7
   16     5        INIT_METHOD_CALL                                         !1, 'bindTo'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !2, $9
   17     9        NEW                                              $11     'ReflectionFunction'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !3, $11
   18    13        UNSET_CV                                                 !2
         14        UNSET_CV                                                 !0
   20    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAL                                                 'Unset%21%21%21'
         17        DO_ICALL                                                 
   21    18        INIT_FCALL                                               'gc_collect_cycles'
         19        DO_ICALL                                                 
   23    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAL                                                 'Done%21%21%21'
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKpCRM%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KpCRM
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_THIS                                       ~0      
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKpCRM%3A12%240

Class FooBar:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KpCRM
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:
159.63 ms | 1396 KiB | 17 Q