php8.5
Home/ Manual/ yaf / yaf_config_simple/ Yaf_Config_Simple::valid

Yaf_Config_Simple::valid

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Check if current position is valid

Description

Yaf_Config_Simple::valid(): bool

Checks whether the current iterator position is valid.

Parameters Parameters

Return Values

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

Examples

Yaf_Config_Simple::valid example

php
<?php
$config = new Yaf_Config_Simple([
    'application' => ['name' => 'MyApp'],
    'database'    => ['host' => 'localhost'],
]);

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

$config->next();
var_dump($config->valid());

$config->next(); // past the last entry
var_dump($config->valid());
?>

The above example will output something similar to:

output
bool(true)
bool(true)
bool(false)

See Also

  • Yaf_Config_Simple::current
  • Yaf_Config_Simple::key
  • Yaf_Config_Simple::next
  • Yaf_Config_Simple::rewind

Source: reference/yaf/yaf_config_simple/valid.xml · from the official PHP manual (php/doc-en)