I would like to make use of somehting like [parse_ini_file][1].
Lets say for instance I have a boot.ini file that I will load for further procedure:
Well, you need to postprocess the parse_ini_file result array then.
$ini_array = parse_ini_file("bootstrap.ini");
$ini = new stdclass;
foreach ($ini_array as $key=>$value) {
$c = $ini;
foreach (explode(".", $key) as $key) {
if (!isset($c->$key)) {
$c->$key = new stdclass;
}
$prev = $c;
$c = $c->$key;
}
$prev->$key = $value;
}
Update Hackety-Hack. Now using an extra $prev to unset the last object level again. (A for loop to detect the last $key would have worked better).
If you want to use the array syntax and the object syntax, then replace the new stdclass with new ArrayObject(array(), 2);.