note 21323 added to function.each
| From: | wodzuY2k at anronet dot pl | Date: | Wed, 08 May 2002 13:40:18 +0000 |
| Subject: | note 21323 added to function.each | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30332@lists.php.net to get a copy of this message | ||
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;
};
};
};
--
http://www.php.net/manual/en/function.each.php
http://master.php.net/manage/user-notes.php?action=edit+21323
http://master.php.net/manage/user-notes.php?action=delete+21323
http://master.php.net/manage/user-notes.php?action=reject+21323