Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Session::__issetYaf_Session::next>
^Yaf_SessionLast updated: Mon, 26 Oct 2026

Yaf_Session::key

(Yaf >=1.0.0)

Yaf_Session::key — Get current session entry key

Description

public function Yaf_Session::key(): mixed

Returns the key of the current session entry during iteration.

Parameters

This function has no parameters.

Return Values

The key of the current session entry.

Examples

Example #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;
}
?>

The above example will output something similar to:

user_id => 42
lang => 'en'

See Also


<Yaf_Session::__issetYaf_Session::next>
^Yaf_SessionLast updated: Mon, 26 Oct 2026