php8.5
Home/ Manual/ yaf / yaf_session/ Yaf_Session::__unset

Yaf_Session::__unset

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Remove a session key

Description

Yaf_Session::__unset(string $name): void

Removes a session key and its value. This method is called when unset() is used on a session object property.

Parameters

name

The session key to remove.

Return Values

No value is returned.

Examples

Yaf_Session::__unset example

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

$session->user_id = 42;

// ... when the user logs out
unset($session->user_id);

var_dump(isset($session->user_id));
?>

The above example will output something similar to:

output
bool(false)

See Also

  • Yaf_Session::del
  • Yaf_Session::offsetUnset

Source: reference/yaf/yaf_session/unset.xml · from the official PHP manual (php/doc-en)