Up to PHP 5.3 we do not have any proper/core function which checks the status of the session.
Here status means, We have called the session_start() function but we wants to make sure that really session is started or not. So this status check function is not available upto PHP 5.3.
So up to PHP 5.3 if we want to check the status of the Session then we have to use below code.
Right now we can use below block code to check if session is started or not.
In PHP 5.4 we have native function which provide us the status of the session either it is started or not. This function is session_status().
This function does not take any parameter and it will return the integer based on the session status.
Have a look at the below code block which shows the use of this function.
In PHP 5.4 with this function session_status() we will have three new constants available which provides the different status of the session.
Here are those status constants:
From PHP 5.4 we will have a native function which is session_status() and also we will have 3 status for the same.
Avinash Zala currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.
View all posts by: Avinash