3v4l.org

run code in 300+ PHP versions simultaneously
<?php function retVal() { return $GLOBALS['foo']; } function & retRef() { return $GLOBALS['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/LoEfu
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'init'
   15     1        INIT_FCALL                                               'retref'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !1, $3
   16     4        ASSIGN                                                   !1, 'bar'
   17     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/LoEfu
function name:  retVal
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_R                      global              ~0      'GLOBALS'
          1        FETCH_DIM_R                                      ~1      ~0, 'foo'
          2      > RETURN                                                   ~1
    6     3*     > RETURN                                                   null

End of function retval

Function retref:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/LoEfu
function name:  retRef
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   FETCH_W                      global              $0      'GLOBALS'
          1        FETCH_DIM_W                                      $1      $0, 'foo'
          2      > RETURN_BY_REF                                            $1
   11     3*     > RETURN_BY_REF                                            null

End of function retref

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.27 ms | 1398 KiB | 16 Q