Yaf_Session::valid
PHP Manual
PHP Manual»Yaf_Session»Yaf_Session::valid

Yaf_Session::valid

(Yaf >=1.0.0)

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

Beschreibung

public function Yaf_Session::valid(): bool

Checks whether the current session iterator position is valid.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

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

Beispiele

Beispiel #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());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

bool(true)
bool(false)

Siehe auch

To Top