PHP » GoLang |
login |
register |
about
|
parse_ini_file(PHP 4, PHP 5, PHP 7) parse_ini_file — Parse a configuration file Description
array parse_ini_file
( string
$filename
[, bool $process_sections = FALSE
[, int $scanner_mode = INI_SCANNER_NORMAL
]] )
parse_ini_file() loads in the
ini file specified in The structure of the ini file is the same as the php.ini's. Parameters
Return Values
The settings are returned as an associative array on success,
and Changelog
Examples
Example #1 Contents of sample.ini ; This is a sample configuration file ; Comments start with ';', as in php.ini [first_section] one = 1 five = 5 animal = BIRD [second_section] path = "/usr/local/bin" URL = "http://www.example.com/~username" [third_section] phpversion[] = "5.0" phpversion[] = "5.1" phpversion[] = "5.2" phpversion[] = "5.3" urls[svn] = "http://svn.php.net" urls[git] = "http://git.php.net" Example #2 parse_ini_file() 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:
<?php The above example will output something similar to: Array ( [one] => 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 ) [urls] => Array ( [svn] => http://svn.php.net [git] => http://git.php.net ) ) 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 ) [urls] => Array ( [svn] => http://svn.php.net [git] => http://git.php.net ) ) )
Example #3 parse_ini_file() parsing a php.ini file
<?php The above example will output something similar to: (parsed) magic_quotes_gpc = Yes (loaded) magic_quotes_gpc = Yes Notes
|
more
Recently updated
more
Most requested
more
Last requests
|