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

Yaf_Config_Simple::key

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Get current entry key

Description

Yaf_Config_Simple::key(): mixed

Returns the key of the current configuration entry during iteration.

Parameters Parameters

Return Values

The key of the current entry (string or integer), or false if the position is invalid.

Examples

Yaf_Config_Simple::key example

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

for ($config->rewind(); $config->valid(); $config->next()) {
    echo $config->key(), "\n";
}
?>

The above example will output something similar to:

output
application
database

See Also

  • Yaf_Config_Simple::current
  • Yaf_Config_Simple::next
  • Yaf_Config_Simple::rewind
  • Yaf_Config_Simple::valid

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