is there a short code trick to check if a session has started and if not then load one? Currently I receive an error \"session already started...\" if I put in a session sta
Checking for existing session before starting new:
// # if phpversion() is >= 5.4
if(phpversion() >= 5.4) {
// # check session_status() function for value 'PHP_SESSION_NONE'
if(session_status() === PHP_SESSION_NONE) {
session_start();
}
} else { // # maintain backwards compat. with PHP versions older than 5.4
// # if $_SESSION object if NOT set, start a new session!
if(!isset($_SESSION)) {
session_start();
}
}