PHP 8.4.26 Released!

Yaf_Session::current

(Yaf >=1.0.0)

Yaf_Session::current — Get current session entry value

Опис

public function Yaf_Session::current(): mixed

Returns the value of the current session entry during iteration.

Параметри

У цієї функції немає параметрів.

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

The value of the current session entry.

Приклади

Приклад #1 Yaf_Session::current() example

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

$session->set("user_id", 42);
$session->set("is_vip", true);

foreach ($session as $key => $value) {
    // Yaf_Session::current() yields each value while iterating
    echo "$key => ";
    var_dump($value);
}
?>

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

user_id => int(42)
is_vip => bool(true)

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

+add a note

User Contributed Notes

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