3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo extends ArrayObject { public $bar; } function create($foo) { $object = new stdClass; $foo->bar = $object; $object->foo = $foo; } gc_collect_cycles(); create(new stdClass()); var_dump(gc_collect_cycles()); // expected '2', actual '2' create(new Foo()); var_dump(gc_collect_cycles()); // expected '2', actual '0'
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rq06B
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'gc_collect_cycles'
          1        DO_ICALL                                                 
   15     2        INIT_FCALL                                               'create'
          3        NEW                                              $1      'stdClass'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $1
          6        DO_FCALL                                      0          
   16     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'gc_collect_cycles'
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
   18    12        INIT_FCALL                                               'create'
         13        NEW                                              $6      'Foo'
         14        DO_FCALL                                      0          
         15        SEND_VAR                                                 $6
         16        DO_FCALL                                      0          
   19    17        INIT_FCALL                                               'var_dump'
         18        INIT_FCALL                                               'gc_collect_cycles'
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rq06B
function name:  create
number of ops:  9
compiled vars:  !0 = $foo, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        NEW                                              $2      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $2
    9     4        ASSIGN_OBJ                                               !0, 'bar'
          5        OP_DATA                                                  !1
   10     6        ASSIGN_OBJ                                               !1, 'foo'
          7        OP_DATA                                                  !0
   11     8      > RETURN                                                   null

End of function create

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.62 ms | 1390 KiB | 19 Q