title: How to set a global variable accessible throughout the application
body: <p>I developed a PHP page with global variable like this;</p>
  
  <pre><code>global $amty_imgCache; $amty_imgCache = array();
  $GLOBALS["amty_imgCache"]=$amty_imgCache;
  </code></pre>
  
  <p>This page has functions to add/delete entries to/from this array.</p>
  
  <p>I called a function on antother PHP page to display its count and to put some elements into this global array this way;</p>
  
  <pre><code>Count &lt;?php echo amty_getImageCacheCount(); ?&gt;
  &lt;?php amty_putIntoImageCache(100,0); ?&gt;
  Count &lt;?php echo amty_getImageCacheCount(); ?&gt;
  </code></pre>
  
  <p>But on every refresh first it displays count 0 then 1. </p>
  
  <p>How can I persist values of global variable across entire application.</p>