Q:

Pick values from array in an order with every refresh

I'm trying to create a simple repetitive counter with PHP.
Let's say I have a array like this:
$letters = array("a","b","c");

I want to display this arrays in this normal order like:

1st refresh : a
2nd refresh : b
3rd refresh : c
4th refresh : a
5th refresh : b
6th refresh : c
goes like this...

How can I a make it happen? Thanks.

A:

This can be done using the $_SESSION variable, by holding the variable in a sessions and having a set of logic in place for each array index. For example:
   session_start();

if(!isset($_SESSION['refresh'])){
    $_SESSION['refresh'] = $letters[0];
}
else{

    switch ($_SESSION['refresh']) {
        case $letters[0]:
            $_SESSION['refresh'] = $letters[1];
            break;
        case $letters[1]:
            $_SESSION['refresh'] = $letters[2];
            break;
       case $letters[2]:
            $_SESSION['refresh'] = $letters[0];
            break;
    }

 }

