Fork me on GitHub

IniParser

Documentation

Constructor

void IniFile::__construct ([ string $file_path ])

Takes one optional parameter, the path to the configuration file to load.

Change The Markers

void IniFile::delimiter ([ string $str ])

Sets the key/value pair delimiter. The default is "=".

void IniFile::comment ([ string $str ])

Sets the comment marker. The default is ";".

Change Options

The option method controls how the parser works.

void IniFile::delimiter ( int $option, bool $flag )
INIPARSER_OPTION_ARRAYS
Determines if the file should be parsed for array constructs. Arrays are in the form of:
name = ( value1, value2, value3 )
INIPARSER_OPTION_HASHES
Determines if the file should be parsed for hash constructs. Hashes are in the form of:
name = {
    name1 = value1
    name2 = value2
}
INIPARSER_OPTION_INHERITENCE
Determines if sections in the file should inherit values from their "parent" sections.

File Reading

void IniFile::refresh ( void )

Re-reads/parses the configuration file.

void IniFile::set_path ([ string $file_path ])

Changes the file path to $file_path and calls $this->refresh();