How to add visited pages urls into a session array?
<p>Everytime the user visit a page, the page url will be stored into an array session. I want to have 10 elements in the array only. So that 10 elements will save 10 latest visited page urls. Here is my codes :</p>

<pre><code>&lt;?php
$currentpageurl = $_GET['username'];

$urlarray=array();

$urlarray[] = $currentpageurl;

$_SESSION['pageurl']=$urlarray;

foreach($_SESSION['pageurl'] as $key=&gt;$value)
    {
    echo 'The value of $_SESSION['."'".$key."'".'] is '."'".$value."'".' &lt;br /&gt;';
    }
?&gt;
</code></pre>

<p>I tested the code, it always overwrite the element in the array with new visited page, thus it has only 1 element in the array. How to make it not to overwrite the element?</p>
