I developed a PHP page with global variable like this;
global $amty_imgCache; $amty_imgCache = array();
$GLOBALS[\"amty_imgCache\"]=$amty_imgCache;
>
You cant really persist variables across the execution of pages without saving them to some persistent store.
If you need to store a variable only for a specific user, use the session using session_start();
and then using $_SESSION;
If it's for the whole application, you should look into using a database or saving data to a file. If saving to a file, checkout serialize()
and unserialize()
which will let you store the state of your variables to a text representation.