I'm studing php and I've read this (important words are bold):
Superglobals — Superglobals are built-in variables that are always available in all scopes These superglobal variables are:
- $GLOBALS
- $_SERVER
- .........
In file1.php
I do:
$GLOBALS["ZZZ"] = 555;
Then I have to send file2.php
to client, so here, in file1.php
I do:
header("Location: /file2.php");
Now I want to retrive my global variable from the global array in file2.php
. I do:
echo "My global = ".$GLOBALS["ZZZ"].";";
And I get emptyness... What do I do wrong? Is $GLOBALS really global or it is new after redirection? Thank you in advance.