parse_ini_string()
parse_ini_string() — Parse a configuration string.
Built-in function of PHP 8.5. The manual lists it as available in PHP 5 >= 5.3.0, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
parse_ini_string() returns the settings in string ini_string in an associative array.
Signature
parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $ini_string | string | The contents of the ini file being parsed. |
| $process_sections | bool | 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 | int | Can either be INI_SCANNER_NORMAL (default) or INI_SCANNER_RAW. If INI_SCANNER_RAW is supplied, then option values will not be parsed. |
Return value
The settings are returned as an associative array on success, and false on failure.
Example
The PHP manual ships no example for parse_ini_string(); the signature and the parameter table above are the contract.
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page parse_ini_string() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.