(PHP 5 >= 5.3.0, PHP 7, PHP 8)
parse_ini_string — Parse a configuration string
$ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false
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 php.ini's.
ini_stringThe contents of the ini file being parsed.
process_sections
By setting the process_sections
parameter to true, you get a multidimensional array, with
the section names and settings included. The default
for process_sections is false
scanner_mode
Can either be INI_SCANNER_NORMAL (default) or
INI_SCANNER_RAW. If INI_SCANNER_RAW
is supplied, then option values will not be parsed.
Починаючи з PHP 5.6.1, можна визначати, як
INI_SCANNER_TYPED. У цьому режимі логічні, нульові та
цілочисельні типи збережуться за можливості. Рядки
"true", "on" та
"yes" перетворяться на true. Відповідно,
"false", "off",
"no" та "none" — на false.
"null" перетвориться на null. Також, усі числові рядки
перетворяться в цілі числа за можливості.
The settings are returned as an associative array on success,
and false on failure.
Зауваження: There are reserved words which must not be used as keys for ini files. These include:
null,yes,no,true,false,on,off,none. Valuesnull,off,noandfalseresult in"", and valueson,yesandtrueresult in"1", unlessINI_SCANNER_TYPEDmode is used. Characters?{}|&~![()^"must not be used anywhere in the key and have a special meaning in the value.