From 9bbfab707a7e8902c033035181b173a906de84db Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy Date: Sun, 11 Nov 2001 11:53:09 +0000 Subject: [PATCH] Adding that really neat parse_ini_file, with a complete example git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@61972 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/filesystem.xml | 107 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 2 deletions(-) diff --git a/functions/filesystem.xml b/functions/filesystem.xml index 8aa360c0b2..844f84b136 100644 --- a/functions/filesystem.xml +++ b/functions/filesystem.xml @@ -1,5 +1,5 @@ - + Filesystem functions Filesystem @@ -2173,6 +2173,110 @@ mkdir ("/path/to/my/dir", 0700); + + + parse_ini_file + Parse a configuration file + + + Description + + + array parse_ini_file + string filename + bool + + process_sections + + + + + + parse_ini_file loads in the + ini file specified in filename, + and returns the settings in it in an associative array. + By setting the last process_sections + parameter to &true;, you get a multidimensional array, with + the section names and settings included. The default + for process_sections is &false; + + + + This function has nothing to do with the + php.ini file. It is already processed, + the time you run your script. This function can be used to + read in your own application's configuration files. + + + + The structure of the ini file is similar to that of + the php.ini's. + + + + Contents of sample.ini + +; This is a sample configuration file +; Comments start with ';', as in php.ini + +[first_section] +one = 1 +five = 5 + +[second_section] +path = /usr/local/bin + + + + + + <function>parse_ini_file</function> example + + +]]> + + + + + Would produce: + + +Array +( + [one] => 1 + [five] => 5 + [path] => /usr/local/bin +) +Array +( + [first_section] => Array + ( + [one] => 1 + [five] => 5 + ) + + [second_section] => Array + ( + [path] => /usr/local/bin + ) + +) + + + + + @@ -2228,7 +2332,6 @@ html - pclose