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

Yaf_Config_Ini::__isset

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Check if a key exists

Description

Yaf_Config_Ini::__isset(string $name): bool

Checks whether a configuration key exists. This method is invoked when isset() is used on a configuration object.

Parameters

name

The configuration key to check.

Return Values

Returns true if the key exists, false otherwise.

Examples

Yaf_Config_Ini::__isset example

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

var_dump(isset($config->database));
var_dump($config->__isset('database'));
var_dump(isset($config->cache));
?>

The above example will output something similar to:

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

See Also

  • Yaf_Config_Ini::get
  • Yaf_Config_Ini::offsetExists

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