Yaf_Config_Ini::offsetExists
Check if a key exists (ArrayAccess)
Description
public bool Yaf_Config_Ini::offsetExists(mixed $name)
Checks whether a configuration key exists. This method is an alias of Yaf_Config_Ini::__isset and is called when isset() is used with array syntax on a configuration object.
Parameters
-
name
-
The configuration key to check.
Return Values
Returns true if the key exists, false otherwise.
Examples
Example #1 Yaf_Config_Ini::offsetExists example
<?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->offsetExists('database'));
var_dump(isset($config['cache']));
?>
The above example will output
something similar to:
bool(true)
bool(true)
bool(false)
See Also
- Yaf_Config_Ini::get
- Yaf_Config_Ini::__isset