3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public readonly int $bar; public function set(int $i) { $this->bar = &$i; } } $i = 1; $foo = new Foo(); $foo->set($i); $i = 20; var_dump($foo->bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NMDAp
function name:  (null)
number of ops:  13
compiled vars:  !0 = $i, !1 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                       !0, 1
   16     1        NEW                                                  $3      'Foo'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $3
   17     4        INIT_METHOD_CALL                                             !1, 'set'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
   18     7        ASSIGN                                                       !0, 20
   19     8        INIT_FCALL                                                   'var_dump'
          9        FETCH_OBJ_R                                          ~8      !1, 'bar'
         10        SEND_VAL                                                     ~8
         11        DO_ICALL                                                     
         12      > RETURN                                                       1

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

End of function set

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.53 ms | 477 KiB | 8 Q