<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filter.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.filter-input.php',
    1 => 'filter_input',
    2 => 'Gets a specific external variable by name and optionally filters it',
  ),
  'up' => 
  array (
    0 => 'ref.filter.php',
    1 => 'Функції Filter',
  ),
  'prev' => 
  array (
    0 => 'function.filter-id.php',
    1 => 'filter_id',
  ),
  'next' => 
  array (
    0 => 'function.filter-input-array.php',
    1 => 'filter_input_array',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/filter/functions/filter-input.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.filter-input" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">filter_input</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">filter_input</span> &mdash; <span class="dc-title">Gets a specific external variable by name and optionally filters it</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.filter-input-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>filter_input</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$type</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$var_name</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$filter</code><span class="initializer"> = <strong><code><a href="filter.constants.php#constant.filter-default">FILTER_DEFAULT</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><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.integer.php" class="type int">int</a></span></span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span><br>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.filter-input-parameters">
  <h3 class="title">Параметри</h3>
  <dl>
   
    <dt><code class="parameter">type</code></dt>
    <dd>
     <span class="simpara">
      One of the <strong><code><a href="filter.constants.php#constant.input-post">INPUT_<span class="replaceable">*</span></a></code></strong> constants.
     </span>
     <div class="warning"><strong class="warning">Увага</strong>
      <p class="simpara">
       The content of the superglobal that is being filtered is the original
       &quot;raw&quot; content provided by the <abbr title="Server Application Programming Interface">SAPI</abbr>,
       prior to any user modification to the superglobal.
       To filter a modified superglobal use
       <span class="function"><a href="function.filter-var.php" class="function">filter_var()</a></span> instead.
      </p>
     </div>
    </dd>
   
   
    <dt><code class="parameter">var_name</code></dt>
    <dd>
     <span class="simpara">
      Name of a variable to filter inside the corresponding
      <code class="parameter">type</code> superglobal.
     </span>
    </dd>
   
   
    <dt><code class="parameter">filter</code></dt>
    <dd>
     <span class="simpara">
      The filter to apply.
      Can be a validation filter by using one of the
      <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_<span class="replaceable">*</span></a></code></strong>
      constants, a sanitization filter by using one of the
      <strong><code><a href="filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_<span class="replaceable">*</span></a></code></strong>
      or <strong><code><a href="filter.constants.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong>, or a custom filter by using
      <strong><code><a href="filter.constants.php#constant.filter-callback">FILTER_CALLBACK</a></code></strong>.
     </span>
     <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
      <span class="simpara">
       The default is <strong><code><a href="filter.constants.php#constant.filter-default">FILTER_DEFAULT</a></code></strong>,
       which is an alias of <strong><code><a href="filter.constants.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong>.
       This will result in no filtering taking place by default.
      </span>
     </p></blockquote>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <span class="simpara">
      Either an associative <span class="type"><a href="language.types.array.php" class="type array">array</a></span> of options,
      or a bitmask of filter flag constants
      <strong><code><a href="filter.constants.php#constant.filter-flag-none">FILTER_FLAG_<span class="replaceable">*</span></a></code></strong>.
     </span>
     <span class="simpara">
      If the <code class="parameter">filter</code> accepts options,
      flags can be provided by using the <code class="literal">&quot;flags&quot;</code> field of array.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.filter-input-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="simpara">
   On success returns the filtered variable.
   If the variable is not set <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned.
   On failure <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> is returned,
   unless the <strong><code><a href="filter.constants.php#constant.filter-null-on-failure">FILTER_NULL_ON_FAILURE</a></code></strong> flag is used,
   in which case <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> is returned.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.filter-input-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 A <span class="function"><strong>filter_input()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$search_html </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_input</span><span style="color: #007700">(</span><span style="color: #0000BB">INPUT_GET</span><span style="color: #007700">, </span><span style="color: #DD0000">'search'</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_SANITIZE_SPECIAL_CHARS</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$search_url </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_input</span><span style="color: #007700">(</span><span style="color: #0000BB">INPUT_GET</span><span style="color: #007700">, </span><span style="color: #DD0000">'search'</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_SANITIZE_ENCODED</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"You have searched for </span><span style="color: #0000BB">$search_html</span><span style="color: #DD0000">.\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">"&lt;a href='?search=</span><span style="color: #0000BB">$search_url</span><span style="color: #DD0000">'&gt;Search again.&lt;/a&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Поданий вище приклад виведе щось
схоже на:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">You have searched for Me &amp;#38; son.
&lt;a href=&#039;?search=Me%20%26%20son&#039;&gt;Search again.&lt;/a&gt;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.filter-input-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.filter-input-array.php" class="function" rel="rdfs-seeAlso">filter_input_array()</a> - Gets external variables and optionally filters them</span></li>
   <li><span class="function"><a href="function.filter-var.php" class="function" rel="rdfs-seeAlso">filter_var()</a> - Filters a variable with a specified filter</span></li>
   <li><span class="function"><a href="function.filter-var-array.php" class="function" rel="rdfs-seeAlso">filter_var_array()</a> - Gets multiple variables and optionally filters them</span></li>
   <li>
    Validation filters
    <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_<span class="replaceable">*</span></a></code></strong>
   </li>
   <li>
    Sanitization filters
    <strong><code><a href="filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_<span class="replaceable">*</span></a></code></strong>
   </li>
  </ul>
 </div>


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