cvs: phpdoc /en/functions filesystem.xml

From: Date: Sun, 11 Nov 2001 11:53:09 +0000
Subject: cvs: phpdoc /en/functions filesystem.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969338664@lists.php.net to get a copy of this message
goba Sun Nov 11 06:53:09 2001 EDT Modified files: /phpdoc/en/functions filesystem.xml Log: Adding that really neat parse_ini_file, with a complete example Index: phpdoc/en/functions/filesystem.xml diff -u phpdoc/en/functions/filesystem.xml:1.86 phpdoc/en/functions/filesystem.xml:1.87 --- phpdoc/en/functions/filesystem.xml:1.86 Sun Nov 11 06:26:04 2001 +++ phpdoc/en/functions/filesystem.xml Sun Nov 11 06:53:09 2001 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.86 $ --> +<!-- $Revision: 1.87 $ --> <reference id="ref.filesystem"> <title>Filesystem functions</title> <titleabbrev>Filesystem</titleabbrev> @@ -2173,6 +2173,110 @@ </refsect1> </refentry> + <refentry id="function.parse-ini-file"> + <refnamediv> + <refname>parse_ini_file</refname> + <refpurpose>Parse a configuration file</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>parse_ini_file</function></funcdef> + <paramdef>string <parameter>filename</parameter></paramdef> + <paramdef>bool + <parameter> + <optional>process_sections</optional> + </parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>parse_ini_file</function> loads in the + ini file specified in <parameter>filename</parameter>, + and returns the settings in it in an associative array. + By setting the last <parameter>process_sections</parameter> + parameter to &true;, you get a multidimensional array, with + the section names and settings included. The default + for <parameter>process_sections</parameter> is &false; + </para> + <note> + <para> + This function has nothing to do with the + <filename>php.ini</filename> 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. + </para> + </note> + <para> + The structure of the ini file is similar to that of + the <filename>php.ini</filename>'s. + </para> + <para> + <example> + <title>Contents of sample.ini</title> + <programlisting> +; 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 + </programlisting> + </example> + </para> + <para> + <example> + <title><function>parse_ini_file</function> example</title> + <programlisting> +<![CDATA[ +<?php + +// Parse without sections +$ini_array = parse_ini_file("sample.ini"); +print_r($ini_array); + +// Parse with sections +$ini_array = parse_ini_file("sample.ini", TRUE); +print_r($ini_array); + +?> +]]> + </programlisting> + </example> + </para> + <para> + Would produce: + <informalexample> + <programlisting> +Array +( + [one] => 1 + [five] => 5 + [path] => /usr/local/bin +) +Array +( + [first_section] => Array + ( + [one] => 1 + [five] => 5 + ) + + [second_section] => Array + ( + [path] => /usr/local/bin + ) + +) + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> <refentry id="function.pathinfo"> <refnamediv> @@ -2227,7 +2331,6 @@ </para> </refsect1> </refentry> - <refentry id="function.pclose"> <refnamediv>

« previous php.doc (#969338664) next »