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); gc_disable(); for ($i=0; $i < 10; $i++) { $deep_clone = clone $foo; gc_collect_cycles(); var_dump($i); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 16
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 16
Branch analysis from position: 26
Branch analysis from position: 16
filename:       /in/FpJ4c
function name:  (null)
number of ops:  27
compiled vars:  !0 = $foo, !1 = $i, !2 = $deep_clone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $3      'stdclass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   21     3        ASSIGN_OBJ                                               !0, 'foo'
          4        OP_DATA                                                  !0
   22     5        NEW                                              $8      'bad'
          6        DO_FCALL                                      0          
          7        ASSIGN_OBJ                                               !0, 'bad'
          8        OP_DATA                                                  $8
   23     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   25    12        INIT_FCALL                                               'gc_disable'
         13        DO_ICALL                                                 
   27    14        ASSIGN                                                   !1, 0
         15      > JMP                                                      ->24
   29    16    >   CLONE                                            ~13     !0
         17        ASSIGN                                                   !2, ~13
   30    18        INIT_FCALL                                               'gc_collect_cycles'
         19        DO_ICALL                                                 
   31    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
   27    23        PRE_INC                                                  !1
         24    >   IS_SMALLER                                               !1, 10
         25      > JMPNZ                                                    ~18, ->16
   32    26    > > RETURN                                                   1

Class bad:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FpJ4c
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/FpJ4c
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:
154.13 ms | 1405 KiB | 21 Q