note 21323 deleted from function.each by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 09:02:02 +0000 |
| Subject: | note 21323 deleted from function.each by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196841@lists.php.net to get a copy of this message | ||
Note Submitter: wodzuY2k at anronet dot pl
----
Yet another useful example of how to make globals out of the config file.
config file:
[section1]
value=foo
PHP result :
variable: $section1_value=foo;
function servicesConfig_makeGlobals()
{
global $servicesConfig;
$servicesConfig = parse_ini_file("servicesConfig.conf", TRUE);
reset($servicesConfig);
while (list ($section, $section_val) = each ($servicesConfig))
{
reset($servicesConfig[$section]);
while (list ($key, $val) = each ($servicesConfig[$section]))
{
$GLOBALS[$section.'_'.$key]=$val;
};
};
};