HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Contents of test.ini"
The parse_ini_file() function parses a configuration (ini) file and returns the settings.
Parameter | Description |
---|---|
file | Required. Specifies the ini file to parse |
process_sections | Optional. If set to TRUE, it returns is a multidimensional array with section names and settings included. Default is FALSE |
scanner_mode |
Optional. Can be one of the following values:
|
Return Value: | An array on success, FALSE on failure |
---|---|
PHP Version: | 4.0+ |
PHP Changelog: | PHP 7.0: Hash marks (#) is no longer recognized as comments PHP 5.6.1: Added INI_SCANNER_TYPED mode PHP 5.3: Added optional scanner_mode parameter |
Contents of "test.ini":
[names]
me = Robert
you = Peter
[urls]
first = "http://www.example.com/"
second = "/"
PHP code (with process_sections set to true):
<?php
print_r(parse_ini_file("test.ini",true));
?>
The output of the code above will be:
Array
(
[names] => Array
(
[me] => Robert
[you] => Peter
)
[urls] => Array
(
[first] => http://www.example.com/
[second] => /
)
)
❮ PHP Filesystem Reference