How can we know that a session is started or not?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / rahul
on head of the page we have to write
session_start();
statement.
| Is This Answer Correct ? | 3 Yes | 9 No |
Answer / kamlesh
we can check is_session_start() by this function.
| Is This Answer Correct ? | 3 Yes | 9 No |
Tell me how to create a session? How to set a value in session? How to remove data from a session?
Write a program to display a table of any given number?
Do you know what are traits?
What is meant by session in php?
How to calculate the difference between two dates using php?
What is data structure in php?
List functions available to sort an php array?
Tell me how can we pass the variable through the navigation between the pages?
how to work lamp server
How can we know the number of days between two given dates using PHP? How can we know the number of days between two given dates using MySQL?
What does $_env mean?
What is member variable?