note 54737 added to function.parse-ini-file
| From: | dimkatpisemdotnet at osu1 dot php dot net | Date: | Thu, 14 Jul 2005 04:33:30 +0000 |
| Subject: | note 54737 added to function.parse-ini-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91930@lists.php.net to get a copy of this message | ||
Class to access ini values at format "section_name.property", for example
$myconf->get("system.name") returns a property "name" in section
"system":
class Settings {
var $properties = array();
function Settings() {
$this->properties = parse_ini_file(_SETTINGS_FILE, true);
}
function get($name) {
if(strpos($name, ".")) {
list($section_name, $property) = explode(".", $name);
$section =& $this->properties[$section_name];
$name = $property;
} else {
$section =& $properties;
}
if(is_array($section) && isset($section[$name])) {
return $section[$name];
}
return false;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.parse-ini-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54737
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54737&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54737&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54737&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54737&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54737&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54737&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54737&report=yes
Search -- http://master.php.net/manage/user-notes.php