Yaf_Session::rewind
PHP Manual
PHP Manual»Yaf_Session»Yaf_Session::rewind

Yaf_Session::rewind

(Yaf >=1.0.0)

Yaf_Session::rewind — Reset session iterator to first entry

Açıklama

public function Yaf_Session::rewind(): void

Rewinds the internal iterator to the first session entry.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

No value is returned.

Örnekler

Örnek 1 Yaf_Session::rewind() example

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

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

foreach ($session as $key => $value) {
    echo "$key => $value", PHP_EOL;
}

// a new foreach implicitly calls rewind() again
foreach ($session as $key => $value) {
    echo "$key => $value", PHP_EOL;
}
?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:

user_id => 42
lang => en
user_id => 42
lang => en

Ayrıca Bakınız

To Top