public static function exists() : bool
    {
        // Start session if needed
        if (! session_id()) {
            Session::start();
        }

        // Loop all arguments
        foreach (func_get_args() as $argument) {

            // Array element
            if (is_array($argument)) {

                // Loop the keys
                foreach ($argument as $key) {

                    // Does NOT exist
                    if (! isset($_SESSION[(string) $key])) {
                        return false;
                    }
                }
            } else {

                // Does NOT exist
                if (! isset($_SESSION[(string) $argument])) {
                    return false;
                }
            }
        }

        return true;
    }
public static function exists() : bool
    {
        // Start session if needed
        if (! session_id()) {
            Session::start();
        }

        // Loop all arguments
        foreach (func_get_args() as $argument) {

            // Array element
            if (is_array($argument)) {

                // Loop the keys
                foreach ($argument as $key) {

                    // Does NOT exist
                    if (! isset($_SESSION[(string) $key])) {
                        return false;
                    }
                }
            } else {

                // Does NOT exist
                if (! isset($_SESSION[(string) $argument])) {
                    return false;
                }
            }
        }

        return true;
    }
public static function exists ( ) : bool { // Start session if needed if ( ! session_id ( ) ) { Session :: start ( ) ; } // Loop all arguments foreach ( func_get_args ( ) as $ argument ) { // Array element if ( is_array ( $ argument ) ) { // Loop the keys foreach ( $ argument as $ key ) { // Does NOT exist if ( ! isset ( $ _SESSION [ ( string ) $ key ] ) ) { return false ; } } } else { // Does NOT exist if ( ! isset ( $ _SESSION [ ( string ) $ argument ] ) ) { return false ; } } } return true ; }
Checks if a session variable exists.

if (Session::exists('user')) {
// Do something...
}

@return bool
Checks if a session variable exists .