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 |
please send me the interview questions and answers to my mail id : srikanthgovardana@yahoo.com or srikanthgovardana@gmail.com
What is a trait in php?
What does php mean?
What is the difference between file_get_contents() and file_put_contents() in php?
What does trim () do in javascript?
What is php oop?
Whether session will work if we disable cookies in client browser ?
Which function(s) in PHP computes the difference of arrays?
Require_once(), require(), include(). What is difference between them?
How to pad an array with the same value multiple times?
What are the differences between require and include, include_once?
What is difference between strstr() and stristr()?