<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Parse a configuration string</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.parse-ini-file.html">parse_ini_file</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.pathinfo.html">pathinfo</a></div> <div class="up"><a href="ref.filesystem.html">Filesystem Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.parse-ini-string" class="refentry"> <div class="refnamediv"> <h1 class="refname">parse_ini_string</h1> <p class="verinfo">(PHP 5 >= 5.3.0)</p><p class="refpurpose"><span class="refname">parse_ini_string</span> — <span class="dc-title">Parse a configuration string</span></p> </div> <div class="refsect1 description" id="refsect1-function.parse-ini-string-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>parse_ini_string</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$ini</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$process_sections</code><span class="initializer"> = false</span></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$scanner_mode</code><span class="initializer"> = INI_SCANNER_NORMAL</span></span> ]] )</div> <p class="para rdfs-comment"> <span class="function"><strong>parse_ini_string()</strong></span> returns the settings in string <em><code class="parameter">ini</code></em> in an associative array. </p> <p class="para"> The structure of the ini string is the same as the <var class="filename">php.ini</var>'s. </p> </div> <div class="refsect1 parameters" id="refsect1-function.parse-ini-string-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">ini</code></em></span> <dd> <p class="para"> The contents of the ini file being parsed. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">process_sections</code></em></span> <dd> <p class="para"> By setting the <em><code class="parameter">process_sections</code></em> parameter to <strong><code>TRUE</code></strong>, you get a multidimensional array, with the section names and settings included. The default for <em><code class="parameter">process_sections</code></em> is <strong><code>FALSE</code></strong> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">scanner_mode</code></em></span> <dd> <p class="para"> Can either be <strong><code>INI_SCANNER_NORMAL</code></strong> (default) or <strong><code>INI_SCANNER_RAW</code></strong>. If <strong><code>INI_SCANNER_RAW</code></strong> is supplied, then option values will not be parsed. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.parse-ini-string-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The settings are returned as an associative <span class="type"><a href="language.types.array.html" class="type array">array</a></span> on success, and <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 notes" id="refsect1-function.parse-ini-string-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> There are reserved words which must not be used as keys for ini files. These include: null, yes, no, true, false, on, off, none. Values null, no and false results in "", yes and true results in "1". Characters <em>?{}|&~![()^"</em> must not be used anywhere in the key and have a special meaning in the value. </span> </p></blockquote> </div> <div class="refsect1 seealso" id="refsect1-function.parse-ini-string-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.parse-ini-file.html" class="function" rel="rdfs-seeAlso">parse_ini_file()</a> - Parse a configuration file</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.parse-ini-file.html">parse_ini_file</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.pathinfo.html">pathinfo</a></div> <div class="up"><a href="ref.filesystem.html">Filesystem Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>