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:  8
compiled vars:  !0 = $x, !1 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_W                      global              $2      'GLOBALS'
          1        ASSIGN_DIM                                               $2, 'x'
          2        OP_DATA                                                  'Root+of+the+file'
    5     3        ECHO                                                     !0
   14     4        INIT_FCALL                                               'checkglobal'
          5        DO_FCALL                                      0          
   17     6        ECHO                                                     !1
          7      > 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:  5
compiled vars:  !0 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_W                      global              $1      'GLOBALS'
          1        ASSIGN_DIM                                               $1, 'z'
          2        OP_DATA                                                  'In+the+function.'
   10     3        ECHO                                                     !0
   11     4      > RETURN                                                   null

End of function checkglobal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.66 ms | 1401 KiB | 14 Q