parse_ini_string
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Parse a configuration string
Description
parse_ini_string() returns the settings in string ini_string in an associative array.
The structure of the ini string is the same as the Ini's.
This function must not be used with untrusted inputs, unless scanner_mode is INI_SCANNER_RAW since the parsed output might contain the values of sensitive constants, such as constants holding a database password.
Parameters
ini_stringThe contents of the ini file being parsed.
process_sectionsBy setting the
process_sectionsparameter to true, you get a multidimensional array, with the section names and settings included. The default forprocess_sectionsis falsescanner_modeCan either be
INI_SCANNER_NORMAL(default) orINI_SCANNER_RAW. IfINI_SCANNER_RAWis supplied, then option values will not be parsed.Typed
Return Values
The settings are returned as an associative array on success, and false on failure.
Notes
There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, false, on, off, none. Values null, off, no and false result in "", and values on, yes and true result in "1", unless INI_SCANNER_TYPED mode is used. Characters ?{}|&~![()^" must not be used anywhere in the key and have a special meaning in the value.