How can we know that a session is started or not?

Answers were Sorted based on User's Feedback



How can we know that a session is started or not?..

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

How can we know that a session is started or not?..

Answer / rahul

on head of the page we have to write
session_start();
statement.

Is This Answer Correct ?    3 Yes 9 No

How can we know that a session is started or not?..

Answer / kamlesh

we can check is_session_start() by this function.

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More PHP Interview Questions

Write a program to find the factorial of a number in php?

0 Answers  


What does $_env means?

0 Answers  


what is the diffrence between for and foreach?

11 Answers   Hirolasoft, IBM, Photon,


How to get number of elements in an array?

0 Answers  


How do I run php?

0 Answers  






display selected value in dropdown list through javascript without page refresh

1 Answers  


List out some tools through which we can draw E-R diagrams for mysql?

6 Answers  


Which method removes the last element from the end of an array?

0 Answers  


A company named Pensar Technologies in chennai has offered me a job as Software Trainee in chennai.But they are asking to pay demand draft of Rs.75000/- in the name of the company.They are saying the gross renumeration will pay Rs.90000/- annually.I want to know whether this is good or bad company?Help me out in this.

18 Answers  


Does not want to see PHPSESSID in the url. How can be done this ?

3 Answers  


Tell me how is it possible to parse a configuration file?

0 Answers  


How to find current date and time?

0 Answers  


Categories