How can we know that a session is started or not?
Answer Posted / deep
we'll have to set a session variable after starting a
session as shown below
--------------------------------------------------
<?php
session_start();
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo "Views=". $_SESSION['views'];
?>
--------------------------------------------------
it will set as well as increment the session variable
or we may simply echo a value to check whether a session is
started or not.
Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
What do you mean by core php?
How many types of arrays are there in php?
What are the differences between echo and print?
What is csrf token and why it is required?
Tell me how can we change the maximum size of the files to be uploaded?
What is mysql_fetch_object?
When to use get and post request?
Why shouldn't I use mysql_* functions in php?
How to know user has read the email-php?
What is difference between python and php?
Which function parses an English textual date or time into Unix timestamp in PHP.
How to connect to mysql from a php script?
How is it possible to parse a configuration file?
Explain some most commonly use string functions in php?
What is urlencode and urldecode in php?