PHP Function Session_Status
php function session_status is a built-in utility that examines the current status of your session. Sessions allow you to store data across many pages of your website or web application. This information is stored on the server side (unless you are using cookies) and the only thing connecting it to your browser is a session ID, which gets appended to all page requests. Since cookies can be easily compromised, it is a good idea to use sessions where possible.
However, this can lead to confusion when trying to write code that uses sessions. You may get an error message like "warning: session has already been started" or the PHP notice "session_start() has been called multiple times".
A quick way to check if a session is active is to check the value of the $_SESSION variable. This is a global variable set when session_start() is executed. You can also call session_id() and it will return an ID if the session has been set.
The php function session_status was introduced in PHP Version 5. It is more reliable than checking the value of $_SESSION and is a more robust method of determining if a session has been started. If you are working with an older version of PHP, the best solution is to use a global flag such as a boolean value or a variable that is set when session_start() is executed.