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
How to delete an element from an array?
How to select a database?
What is difference between python and php?
how retrive the video file in php using video tag
Is empty in excel?
What is the static variable in function useful for?
What is the correct php command to use to catch any error messages within the code?
What are the steps involved to run php?
How to calculate the difference between two dates using php?
What is the difference between myisam and innodb?
Why use php artisan serve?
How to split a string into array using php?
How can you upload a file using php?
What is the name of the scripting engine that powers PHP?
What is basic php?