php8.5
Home/ Manual/ yaf / yaf_config_ini/ Yaf_Config_Ini::valid

Yaf_Config_Ini::valid

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Check if current position is valid

Description

Yaf_Config_Ini::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_Ini::valid example

php
<?php
/**
 * Assume /etc/myapp/application.ini contains:
 * [common]
 * application.name = "MyApp"
 * version          = "1.0"
 */
$config = new Yaf_Config_Ini('/etc/myapp/application.ini', 'common');

$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_Ini::current
  • Yaf_Config_Ini::key
  • Yaf_Config_Ini::next
  • Yaf_Config_Ini::rewind

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