0

hi
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
thaaaaanx

<?php
session_start();
// store session data
$_SESSION['views']=1;
?>

<html>
<body>

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

</body>
</html>
4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by kekkaishi
0

$_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

0

$_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.