3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bad { private $_private = array(); public function __construct() { $this->_private[] = 'oh noes'; } public function __destruct() { //echo "bad::destructor\n"; global $bar; $bar = $this->_private; } } $foo = new stdclass; $foo->foo = $foo; $foo->bad = new bad; print_r($foo); $bar = new stdclass; $bar->foo = $bar; $bar->bad = new bad; gc_collect_cycles();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJ3vQ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'stdclass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        ASSIGN_OBJ                                               !0, 'foo'
          4        OP_DATA                                                  !0
   22     5        NEW                                              $7      'bad'
          6        DO_FCALL                                      0          
          7        ASSIGN_OBJ                                               !0, 'bad'
          8        OP_DATA                                                  $7
   23     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   25    12        NEW                                              $10     'stdclass'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $10
   26    15        ASSIGN_OBJ                                               !1, 'foo'
         16        OP_DATA                                                  !1
   27    17        NEW                                              $15     'bad'
         18        DO_FCALL                                      0          
         19        ASSIGN_OBJ                                               !1, 'bad'
         20        OP_DATA                                                  $15
   29    21        INIT_FCALL                                               'gc_collect_cycles'
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class bad:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJ3vQ
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_W                                      $0      '_private'
          1        ASSIGN_DIM                                               $0
          2        OP_DATA                                                  'oh+noes'
    9     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/LJ3vQ
function name:  __destruct
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   BIND_GLOBAL                                              !0, 'bar'
   16     1        FETCH_OBJ_R                                      ~1      '_private'
          2        ASSIGN                                                   !0, ~1
   17     3      > RETURN                                                   null

End of function __destruct

End of class bad.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.53 ms | 1388 KiB | 17 Q