adspace


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


Please Help Members By Posting Answers For Below Questions

how to detect a mobile device using php

1177


How to calculate the difference between two dates using php?

1151


Write a program using while loop?

1128


Explain me is it possible to destroy a cookie?

1035


What is the current stable version of php? What advance thing in php7?

1100


What is trait in php?

1072


Tell me what kind of things have you done on the social side?

1071


if you run the app program all vendor open items are cleared but is it possible to reverse the again again open items please tell me the answer

1997


What is the difference between htmlentities() and htmlspecialchars()?

1100


What is difference between static and final in php?

1114


List some features of php that are deprecated in php7?

1026


Name and explain five of the PHP error constants?

1043


Which variable declarations within a class is invalid in php?

1052


What is the current stable version of php?

1130


sort term descripttion form, report and uery

2257