\donbidon\Lib\ConfigIni

Extended parse_ini_string() supporting nested sections.

print_r(\donbidon\Lib\Config\Ini::parse(
    file_get_contents("/path/to/config.php"),
    TRUE)
);

applied to the following ini-file

; <?php die; __halt_compiler();
[section]
subsection.arg.foo = "source foo"
subsection.array[] = "value 0"
subsection.array[] = "value 1"

[section.subsection]
arg.foo = "overridden foo"
array.newKey = "new key"

outputs

Array
(
    [section] => Array
        (
            [subsection] => Array
                (
                   [arg] => Array
                        (
                            [foo] => overridden foo
                        )

                    [array] => Array
                        (
                            [0] => value 0
                            [1] => value 1
                            [newKey] => new key
                        )
             )
        )
)

Summary

Methods
Properties
Constants
setSectionDelimiter()
parse()
No public properties found
No constants found
No protected methods found
$delimiter
N/A
No private methods found
No private properties found
N/A

Properties

$delimiter

$delimiter : string

Nested section delimiter

Type

string

Methods

setSectionDelimiter()

setSectionDelimiter(string  $delimiter) : void

Sets nested sections delimiter

Parameters

string $delimiter

parse()

parse(string  $string, boolean  $sections = false, integer  $mode = INI_SCANNER_NORMAL) : array|false

Parses a configuration string.

Cuts PHP-docblock containing file summary and ending with "__halt_compiler();".

Parameters

string $string
boolean $sections

Process sections

integer $mode

Scanner mode

Returns

array|false