When refreshing the page,cause session variables to be cleared
<p>Why in reloading page <code>$_SESSION</code> variables re-sets again?!</p>

<pre><code>  if (isset($_SESSION['LAST_ACTIVITY']) &amp;&amp; ((time() - $_SESSION['LAST_ACTIVITY']) &gt; 1800)) 
            {
                // last request was more than 30 minutes ago
                session_unset();     
                session_destroy();   
            }
            $_SESSION['LAST_ACTIVITY'] = time();
if (!isset($_SESSION['CREATED'])) {
            $_SESSION['CREATED'] = time();
            } else if (time() - $_SESSION['CREATED'] &gt; 1800) {
                // session started more than 30 minutes ago
                session_regenerate_id(true);    // change session ID for the current session and invalidate old session ID
                $_SESSION['CREATED'] = time();  // update creation time
            }
</code></pre>

<p>Is my code wrong?<br>
In my php.ini </p>

<pre><code>session.cache_expire = 180    
session.use_cookies = 0    
session.use_only_cookies = 0   
session.auto_start = 0    
session.gc_maxlifetime = 1440   
session.cache_expire = 180
</code></pre>

<hr>

<p>I have <code>session_start()</code> at top of page<br>
<code>var_dump($_SESSION)</code> in page results deferent <code>$_SESSION</code> values !!</p>

<pre><code>array (size=2)  
  'LAST_ACTIVITY' =&gt; int 1472457503  
  'CREATED' =&gt; int 1472457503 
</code></pre>

<p>Refreshing again !</p>

<pre><code>array (size=2)
  'LAST_ACTIVITY' =&gt; int 1472459001
  'CREATED' =&gt; int 1472459001
</code></pre>

<p>The <code>LAST_ACTIVITY</code> is normal when changes<br>
BUT why <code>'CREATED'</code> is changed!!??</p>