3v4l.org

run code in 300+ PHP versions simultaneously
<?php function retVal() { global $foo; return $foo; } function & retRef() { global $foo; return $foo; } $foo = 'init'; $bar = retRef(); $bar = 'bar'; var_dump($foo, $bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gPv9n
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 'init'
   17     1        INIT_FCALL                                               'retref'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !1, $3
   18     4        ASSIGN                                                   !1, 'bar'
   19     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function retval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gPv9n
function name:  retVal
number of ops:  3
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_GLOBAL                                              !0, 'foo'
    6     1      > RETURN                                                   !0
    7     2*     > RETURN                                                   null

End of function retval

Function retref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/gPv9n
function name:  retRef
number of ops:  3
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   BIND_GLOBAL                                              !0, 'foo'
   12     1      > RETURN_BY_REF                                            !0
   13     2*     > RETURN_BY_REF                                            null

End of function retref

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.21 ms | 1397 KiB | 16 Q