PHP 8.6.0 Beta 3 is available for testing

Yaf_Session::offsetExists

(Yaf >=1.0.0)

Yaf_Session::offsetExistsCheck if a session key exists (ArrayAccess)

Опис

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.

Параметри

name

The session key to check.

Значення, що повертаються

Returns true if the key exists, false otherwise.

Приклади

Приклад #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"]));
?>

Поданий вище приклад виведе щось схоже на:

bool(true)
bool(false)

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top