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>

Recommended Answers

First of all, You need to understand what is sessions in php.
Click the below links to find out how you can access sessions in php.
php sessions

Jump to Post

All 3 Replies

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

First of all, You need to understand what is sessions in php.
Click the below links to find out how you can access sessions in php.
php sessions
session examples

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.