3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { private $f; public function __construct(&$f) { $this->f = &$f; } public function __destruct() { $this->f = 1; } } $f = function () use (&$f) { $t = new test($f); print "After this line it the Closure should be destroyed..."; }; $f(); var_dump($f);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nqYt2
function name:  (null)
number of ops:  9
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FnqYt2%3A15%240'
          1        BIND_LEXICAL                                             ~1, !0
          2        ASSIGN                                                   !0, ~1
   20     3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0          
   22     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FnqYt2%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nqYt2
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $f, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   BIND_STATIC                                              !0
   16     1        NEW                                              $2      'test'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $2
   17     5        ECHO                                                     'After+this+line+it+the+Closure+should+be+destroyed...'
   18     6      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FnqYt2%3A15%240

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nqYt2
function name:  __construct
number of ops:  4
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ_REF                                           'f'
          2        OP_DATA                                                  !0
    8     3      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nqYt2
function name:  __destruct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN_OBJ                                               'f'
          1        OP_DATA                                                  1
   12     2      > RETURN                                                   null

End of function __destruct

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.3 ms | 1388 KiB | 15 Q