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 is different between software and app
Explain mail function in PHP with syntax?
How can we submit from without a submit button?
Where is session value stored?
Why php is also called as scripting language?
How many columns can be added in a table in mysql?
How many types of array supported in php?
Explain what is the main difference between require() and require_once()?
What are psrs? Choose 1 and briefly describe it?
How send email using php?
Explain me what is the use of 'print' in php?
Why php is widely used?
What types of Data Can Be Used as Array Keys?
Which function can be used to exit from the script after displaying the error message?
Is age interval or ordinal?