3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tmp { function __destruct() { var_dump("destroying"); } } $tmp = new Tmp(); $fn = function () use ($tmp) { $tmp = 42; var_dump("closure executed"); }; var_dump("closure defined"); unset($tmp); var_dump("original var unset"); $fn();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Utd9j
function name:  (null)
number of ops:  16
compiled vars:  !0 = $tmp, !1 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $2      'Tmp'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   11     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FUtd9j%3A11%240'
          4        BIND_LEXICAL                                             ~5, !0
          5        ASSIGN                                                   !1, ~5
   16     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAL                                                 'closure+defined'
          8        DO_ICALL                                                 
   17     9        UNSET_CV                                                 !0
   18    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAL                                                 'original+var+unset'
         12        DO_ICALL                                                 
   19    13        INIT_DYNAMIC_CALL                                        !1
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FUtd9j%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Utd9j
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   BIND_STATIC                                              !0
   12     1        ASSIGN                                                   !0, 42
   13     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAL                                                 'closure+executed'
          4        DO_ICALL                                                 
   14     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FUtd9j%3A11%240

Class Tmp:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Utd9j
function name:  __destruct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'destroying'
          2        DO_ICALL                                                 
    6     3      > RETURN                                                   null

End of function __destruct

End of class Tmp.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.31 ms | 1396 KiB | 15 Q