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::__unsetYaf_Exception>
^Yaf_SessionLast updated: Mon, 26 Oct 2026

Yaf_Session::valid

(Yaf >=1.0.0)

Yaf_Session::valid — Check if current session position is valid

Description

public function Yaf_Session::valid(): bool

Checks whether the current session iterator position is valid.

Parameters

This function has no parameters.

Return Values

Returns true if the current position is valid, false otherwise.

Examples

Example #1 Yaf_Session::valid() example

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

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

$session->rewind();
var_dump($session->valid());

$session->next();
// past the last entry, the position is no longer valid
var_dump($session->valid());
?>

The above example will output something similar to:

bool(true)
bool(false)

See Also


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