Yaf_Session::offsetExists
PHP Manual
PHP Manual»Yaf_Session»Yaf_Session::offsetExists

Yaf_Session::offsetExists

(Yaf >=1.0.0)

Yaf_Session::offsetExists — Check if a session key exists (ArrayAccess)

Descrizione

public function Yaf_Session::offsetExists(mixed $name): bool

Checks whether a session key exists. This method is an alias of Yaf_Session::has() and is called when isset() is used with array syntax.

Elenco dei parametri

name

The session key to check.

Valori restituiti

Returns true if the key exists, false otherwise.

Esempi

Example #1 Yaf_Session::offsetExists() example

<?php
$session = Yaf_Session::getInstance();
$session->start();

$session["user_id"] = 42;

var_dump(isset($session["user_id"]));
var_dump(isset($session["user_name"]));
?>

Il precedente esempio visualizzerà qualcosa simile a:

bool(true)
bool(false)

Vedere anche:

To Top