Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Do csrf tokens expire?

964


What is the difference between $var and $$var?

1048


What is a composer in PHP?

939


What is php explain?

937


Explain preg_Match and preg_replace?

953


What is the difference between md5(), crc32() and sha1() crypto on php?

1042


What are computer variables?

932


Is age an interval or ratio?

949


What is the use of array_count_values() in php?

1015


Is php a low level language?

960


What is the function of trim?

921


What are the differences between session and cookie?

997


Tell me how can we determine whether a php variable is an instantiated object of a certain class?

998


What is the use of strpos in php?

1032


What is polymorphism with example in php?

937