3v4l.org

run code in 300+ PHP versions simultaneously
<?php // working here $GLOBALS['x'] = "Root of the file"; echo $x; // same things are not working in the function. function checkglobal() { $GLOBALS['z'] = "In the function."; echo $z; } // Run the function checkglobal(); // Echo the variable set in the function echo $z;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5TYMJ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $x, !1 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_W                      global              $2      'x'
          1        ASSIGN                                                   $2, 'Root+of+the+file'
    5     2        ECHO                                                     !0
   14     3        INIT_FCALL                                               'checkglobal'
          4        DO_FCALL                                      0          
   17     5        ECHO                                                     !1
          6      > RETURN                                                   1

Function checkglobal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5TYMJ
function name:  checkglobal
number of ops:  4
compiled vars:  !0 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_W                      global              $1      'z'
          1        ASSIGN                                                   $1, 'In+the+function.'
   10     2        ECHO                                                     !0
   11     3      > RETURN                                                   null

End of function checkglobal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.41 ms | 999 KiB | 14 Q