<?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');
// Dot notation for nested access
echo $config->get('database.host'), "\n";
// Array values are wrapped in a Yaf_Config_Ini object
echo $config->get('database')->port, "\n";
// No argument: the configuration object itself is returned
echo $config->get()->application->name, "\n";
var_dump($config->get('missing.key'));
?>
The above example will output
something similar to:
localhost
3306
MyApp
NULL