title: How to get previously stored $_SESSION value?
body: <p>I am here storing the randomly generated value from <code>rand()</code> into <code>$_SESSION['previous_rand']</code></p>
  <p>. I am also <code>echo</code> both the <code>current generated rand()</code> and previously stored in <code>$_SESSION['previous_rand']</code></p>
  <p>but it showing the <code>current generated rand()</code>   into the  <code>previously generated rand()</code> field.</p>
  <p>How can i make it show the <code>previously generated rand()</code> correctly?</p>
  <pre><code>&lt;?php
  
  session_start();
  
  $rand = rand(1000,9999);
  $_SESSION['previous_rand'] = $rand;
  
  
  echo &quot;Current generated RAND: &quot; . $rand;
  echo &quot;&lt;br&gt;&quot;;
  echo &quot;Previously generated RAND: &quot; . $_SESSION['previous_rand'];
    
  ?&gt;
  </code></pre>