how to check if session is started in php code example
Example 1: php start session if not started
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
Example 2: php check if session is running
<?php
if(session_status() == PHP_SESSION_ACTIVE){
//a session is already running
session_destroy(); //stops the session
}
?>