<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filesystem.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.parse-ini-string.php',
    1 => 'parse_ini_string',
    2 => 'Parse a configuration string',
  ),
  'up' => 
  array (
    0 => 'ref.filesystem.php',
    1 => 'Filesystem Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.parse-ini-file.php',
    1 => 'parse_ini_file',
  ),
  'next' => 
  array (
    0 => 'function.pathinfo.php',
    1 => 'pathinfo',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/filesystem/functions/parse-ini-string.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.parse-ini-string" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">parse_ini_string</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">parse_ini_string</span> &mdash; <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">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>parse_ini_string</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$ini_string</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$process_sections</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$scanner_mode</code><span class="initializer"> = <strong><code><a href="filesystem.constants.php#constant.ini-scanner-normal">INI_SCANNER_NORMAL</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>parse_ini_string()</strong></span> returns the settings in string
   <code class="parameter">ini_string</code> 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>&#039;s.
  </p>
  <div class="warning"><strong class="warning">Avviso</strong>
   <p class="simpara">
    This function must not be used with untrusted inputs, unless
    <code class="parameter">scanner_mode</code> is <strong><code><a href="filesystem.constants.php#constant.ini-scanner-raw">INI_SCANNER_RAW</a></code></strong>
    since the parsed output might contain the values of sensitive
    constants, such as constants holding a database password.
   </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.parse-ini-string-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">ini_string</code></dt>
     <dd>
      <p class="para">
       The contents of the ini file being parsed.
      </p>
     </dd>
    
    
     <dt><code class="parameter">process_sections</code></dt>
     <dd>
      <p class="para">
       By setting the <code class="parameter">process_sections</code>
       parameter to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, you get a multidimensional array, with
       the section names and settings included. The default
       for <code class="parameter">process_sections</code> is <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>      
      </p>
     </dd>
    
    
     <dt><code class="parameter">scanner_mode</code></dt>
     <dd>
      <p class="para">
       Can either be <strong><code><a href="filesystem.constants.php#constant.ini-scanner-normal">INI_SCANNER_NORMAL</a></code></strong> (default) or 
       <strong><code><a href="filesystem.constants.php#constant.ini-scanner-raw">INI_SCANNER_RAW</a></code></strong>. If <strong><code><a href="filesystem.constants.php#constant.ini-scanner-raw">INI_SCANNER_RAW</a></code></strong> 
       is supplied, then option values will not be parsed.
      </p>
      <p class="para">
    As of PHP 5.6.1 can also be specified as <strong><code><a href="filesystem.constants.php#constant.ini-scanner-typed">INI_SCANNER_TYPED</a></code></strong>.
    In this mode boolean, null and integer types are preserved when possible.
    String values <code class="literal">&quot;true&quot;</code>, <code class="literal">&quot;on&quot;</code> and <code class="literal">&quot;yes&quot;</code>
    are converted to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>. <code class="literal">&quot;false&quot;</code>, <code class="literal">&quot;off&quot;</code>, <code class="literal">&quot;no&quot;</code>
    and <code class="literal">&quot;none&quot;</code> are considered <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. <code class="literal">&quot;null&quot;</code> is converted to <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>
    in typed mode. Also, all numeric strings are converted to integer type if it is possible.
   </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.parse-ini-string-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   The settings are returned as an associative <span class="type"><a href="language.types.array.php" class="type array">array</a></span> on success,
   and <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.parse-ini-string-notes">
  <h3 class="title">Note</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <span class="simpara">
    There are reserved words which must not be used as keys for
    ini files.  These include: <code class="literal">null</code>, <code class="literal">yes</code>, 
    <code class="literal">no</code>, <code class="literal">true</code>, <code class="literal">false</code>,
    <code class="literal">on</code>, <code class="literal">off</code>, <code class="literal">none</code>.
    Values <code class="literal">null</code>, <code class="literal">off</code>, <code class="literal">no</code> and 
    <code class="literal">false</code> result in <code class="literal">&quot;&quot;</code>, and values
    <code class="literal">on</code>, <code class="literal">yes</code> and <code class="literal">true</code> result
    in <code class="literal">&quot;1&quot;</code>, unless <strong><code><a href="filesystem.constants.php#constant.ini-scanner-typed">INI_SCANNER_TYPED</a></code></strong> mode is used.
    Characters <code class="literal">?{}|&amp;~![()^&quot;</code> 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">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.parse-ini-file.php" class="function" rel="rdfs-seeAlso">parse_ini_file()</a> - Legge un file di configurazione</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>