3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $x; } $x = new Foo(); $x->x = $x; // comment this line out $y = new WeakRef($x); unset($x); var_dump($y->get()); gc_collect_cycles(); var_dump($y->get());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o2kk2
function name:  (null)
number of ops:  23
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        ASSIGN_OBJ                                               !0, 'x'
          4        OP_DATA                                                  !0
    9     5        NEW                                              $6      'WeakRef'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   10     9        UNSET_CV                                                 !0
   11    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !1, 'get'
         12        DO_FCALL                                      0  $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                                 
   12    15        INIT_FCALL                                               'gc_collect_cycles'
         16        DO_ICALL                                                 
   13    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !1, 'get'
         19        DO_FCALL                                      0  $12     
         20        SEND_VAR                                                 $12
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.11 ms | 1395 KiB | 17 Q