i wanaa ask
what is $_SESSION=1;
mean ???
i think its like array but i don't know
and what is "views"
is it index ?
can i change it ?
if it is index why in each page i just write views
i mean why i didn't change the index how can i store new Variable each time at the same index

// store session data


//retrieve session data
echo "Pageviews=". $_SESSION['views'];

6 Years
Discussion Span
Last Post by kekkaishi

$_SESSION It is mean An associative array containing session variables available to the current script.'views;is the name of the file stord in session you can not change it for the current session but you can create a new one with different name . $_SESSION=1; it mean the SESSION that named 'views' equal to 1

Edited by aaraf: n/a


$_SESSION is a super-global variable you could use to store temporary data. It is an associative array and 'views' indeed could be said as an index. Instead of having numeric values as indexes as in normal arrays, in associative arrays you could have words as indexes. So in this case, $_SESSION = 1 means that you are storing 1 in $_SESSION array under index 'views'. If you perhaps want to store 2 in another name you could simply say $_SESSION=2; Or, if you want to assign 3 to 'views' you could just say $_SESSION = 3. Later on, if you want to call these, you could just call $_SESSION to get the value 3 (because 3 was stored later) and $_SESSION to get the value 2.
As paulrajj, I also recommend that you read about PHP sessions. This line would also be a helpful link to learn about sessions. http://www.tizag.com/phpT/phpsessions.php. I also recommend that you read about associative arrays. http://www.tizag.com/phpT/arrays.php
Hope you understood and hope this was of help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.