PHP 8.6.0 Beta 3 is available for testing

Yaf_Session::key

(Yaf >=1.0.0)

Yaf_Session::keyGet current session entry key

Beschreibung

public function Yaf_Session::key(): mixed

Returns the key of the current session entry during iteration.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

The key of the current session entry.

Beispiele

Beispiel #1 Yaf_Session::key() example

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

$session->set("user_id", 42);
$session->set("lang", "en");

for ($session->rewind(); $session->valid(); $session->next()) {
    echo $session->key(), " => ", var_export($session->current(), true), PHP_EOL;
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

user_id => 42
lang => 'en'

Siehe auch

add a note

User Contributed Notes

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