3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $foo = "local variable"; echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n"; echo '$foo in current scope: ' . $foo . "\n"; } $foo = "Example content"; test(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KOCag
function name:  (null)
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, 'Example+content'
   10     1        INIT_FCALL                                               'test'
          2        DO_FCALL                                      0          
   11     3      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KOCag
function name:  test
number of ops:  10
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'local+variable'
    5     1        FETCH_R                      global              ~2      'GLOBALS'
          2        FETCH_DIM_R                                      ~3      ~2, 'foo'
          3        CONCAT                                           ~4      '%24foo+in+global+scope%3A+', ~3
          4        CONCAT                                           ~5      ~4, '%0A'
          5        ECHO                                                     ~5
    6     6        CONCAT                                           ~6      '%24foo+in+current+scope%3A+', !0
          7        CONCAT                                           ~7      ~6, '%0A'
          8        ECHO                                                     ~7
    7     9      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.57 ms | 1396 KiB | 14 Q