KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Basically, I would like a simple, easy, one-file way to parse an INI file with "advanced" features, like section inheritance and property nesting, like Zend_Config_Ini . For example: [foo] a = 1 b.a = 2 b.b = 3 b.c = 4 c = 5 [bar : foo] b.b = 17 c = 42 Would parse into array( 'foo'=>array( 'a'=>'1', 'b'=>array( 'a'=>'2', 'b'=>'3', 'c'=>'4' ), 'c'=>'5' ), 'bar'=>array( 'a'=>'1', 'b'=>array( 'a'=>'2', 'b'=>'17', 'c'=>'4' ), 'c'=>'42' ) ) PHP's built-in parse_ini_file , doesn't handle anything other than simple INI's with simple sections and simple keys. My problem with using Zend_Config_Ini is that I would have to include virtually the whole Zend_Config subpackage, and is super-bloated and configurable. Is there a small and simple library available to parse this? If not, is there an easy implementation I'm not seeing? By small and simple, I mean something like the sfYaml of INI files. To my (very inexperienced) eyes, I would have to parse through once with parse_ini_file , then come back and resolve inheritance, then run through each section and expand the keys recursively... UPDATE : Since this seems to be a popular question, I would like to note that I have a simple class implementing this on GitHub , feel free to send pull requests, issues, etc.
Tags (comma-separated)
Save Edits
Cancel