Yaf_Session::rewind

Reset session iterator to first entry

Description

public void Yaf_Session::rewind()

Rewinds the internal iterator to the first session entry.

Parameters

This function has no parameters.

Return Values

No value is returned.

Examples

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

The above example will output something similar to:

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

See Also

  • Yaf_Session::current
  • Yaf_Session::key
  • Yaf_Session::next
  • Yaf_Session::valid