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

Yaf_Config_Simple::count

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Count configuration entries

Description

Yaf_Config_Simple::count(): int

Returns the number of top-level configuration entries.

Parameters Parameters

Return Values

The number of top-level entries as an integer.

Examples

Yaf_Config_Simple::count example

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

// Only the top-level entries ("application" and "database") are counted
var_dump(count($config));
var_dump($config->count());
?>

The above example will output something similar to:

output
int(2)
int(2)

See Also

  • Yaf_Config_Simple::get
  • Yaf_Config_Simple::toArray

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