PHP parse_ini_file() Function

PHP parse_ini_string() Function
PHP move_uploaded_file() Function

In this article, you will learn how to read and parse the configuration file in PHP. The configuration files in PHP are determined by the .ini extension. The parse_ini_file() function in PHP parses a configuration (ini) file and returns the settings.

Remember that the PARSE_INI_FILE function only reads the user-defined configuration in files. It does not access the php.ini file.

what is the syntax of the PARSE_INI_FILE function in php?

parse_ini_file(file, process_sections, scanner_mode)
ParameterDescription
fileRequired. Specifies the ini file to parse
process_sectionsOptional. If set to TRUE, it returns is a multidimensional array with section names and settings included. Default is FALSE
scanner_modeOptional. Can be one of the following values:INI_SCANNER_NORMAL (default)INI_SCANNER_RAW (means option values will not be parsed)INI_SCANNER_TYPED (means that boolean, null and integer types are preserved when possible. “true”, “on”, “yes” are converted to TRUE. “false”, “off”, “no”, “none” are converted to FALSE. “null” is converted to NULL. Numeric strings are converted to integer type if possible)
PHP PARSE_INI_FILE() method

examples of the PARSE_INI_FILE function

Example 1. In this example, we parse the ini file in PHP. Suppose the ini file is named “test.ini”.

<?php
print_r(parse_ini_file("test.ini"));
?>
PHP parse_ini_string() Function
PHP move_uploaded_file() Function
en English
X
Scroll to Top