3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static $y = 1; public static function foo(&$x) { $x = &self::$y; } } $bar = 0; Test::foo($bar); echo $bar; //why is this not 1?
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hf8Pg
function name:  (null)
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 0
   15     1        INIT_STATIC_METHOD_CALL                                  'Test', 'foo'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
   16     4        ECHO                                                     !0
          5      > RETURN                                                   1

Class Test:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hf8Pg
function name:  foo
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        FETCH_STATIC_PROP_W          unknown             $1      'y'
          2        ASSIGN_REF                                               !0, $1
   10     3      > RETURN                                                   null

End of function foo

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.76 ms | 1001 KiB | 13 Q