parse_ini_file Parse a configuration file &reftitle.description; arrayparse_ini_file stringfilename boolprocess_sectionsfalse intscanner_modeINI_SCANNER_NORMAL parse_ini_file loads in the ini file specified in filename, and returns the settings in it in an associative array. The structure of the ini file is the same as the &php.ini;'s. &reftitle.parameters; filename The filename 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. &reftitle.returnvalues; The settings are returned as an associative array on success, and &false; on failure. &reftitle.changelog; &Version; &Description; 5.3.0 Added optional scanner_mode parameter. Single quotes may now be used around variable assignments. Hash marks (#) may no longer be used as comments and will throw a deprecation warning if used. 5.2.7 On syntax error this function will return &false; rather then an empty array. 5.2.4 Keys and section names consisting of numbers are now evaluated as PHP integers thus numbers starting by 0 are evaluated as octals and numbers starting by 0x are evaluated as hexadecimals. 5.0.0 Values enclosed in double quotes can contain new lines. 4.2.1 This function is now affected by &safemode; and open_basedir. &reftitle.examples; Contents of <filename>sample.ini</filename> <function>parse_ini_file</function> example Constants may also be parsed in the ini file so if you define a constant as an ini value before running parse_ini_file, it will be integrated into the results. Only ini values are evaluated. For example: ]]> &example.outputs.similar; 1 [five] => 5 [animal] => Dodo bird [path] => /usr/local/bin [URL] => http://www.example.com/~username [phpversion] => Array ( [0] => 5.0 [1] => 5.1 [2] => 5.2 [3] => 5.3 ) ) Array ( [first_section] => Array ( [one] => 1 [five] => 5 [animal] => Dodo bird ) [second_section] => Array ( [path] => /usr/local/bin [URL] => http://www.example.com/~username ) [third_section] => Array ( [phpversion] => Array ( [0] => 5.0 [1] => 5.1 [2] => 5.2 [3] => 5.3 ) ) ) ]]> <function>parse_ini_file</function> parsing a php.ini file ]]> &example.outputs.similar; &reftitle.notes; This function has nothing to do with the &php.ini; file. It is already processed by the time you run your script. This function can be used to read in your own application's configuration files. If a value in the ini file contains any non-alphanumeric characters it needs to be enclosed in double-quotes ("). 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, no and false results in "", yes and true results in "1". Characters ?{}|&~![()^" must not be used anywhere in the key and have a special meaning in the value. &reftitle.seealso; parse_ini_string