<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/filter.constants.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'filter.constants.sanitization.php',
    1 => 'Sanitizing Filters',
    2 => 'Sanitizing Filters',
  ),
  'up' => 
  array (
    0 => 'filter.constants.php',
    1 => 'Попередньо визначені константи',
  ),
  'prev' => 
  array (
    0 => 'filter.constants.validation.php',
    1 => 'Validation Filters',
  ),
  'next' => 
  array (
    0 => 'filter.constants.callback.php',
    1 => 'User Defined Filter',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/filter/constants.sanitization.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="filter.constants.sanitization" class="section">
 <h2 class="title">Sanitizing Filters</h2>
 <p class="simpara">
Константи, описані нижче — визначені цим розширенням, тож доступні, коли
розширення скомпільовано як частина PHP або динамічно підключене під час
виконання.
</p>
 <dl>
  
   <dt id="constant.filter-unsafe-raw">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     This filter does nothing.
    </p>
    <p class="simpara">
     However, it can strip or encode special characters if used together with
     the <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     and <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_<span class="replaceable">*</span></a></code></strong>
     filter sanitization flags.
    </p>
   </dd>
  
  
   <dt id="constant.filter-default">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-default">FILTER_DEFAULT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Псевдонім <strong><code><a href="filter.constants.sanitization.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong>.
    </p>
   </dd>
  
  
   <dt id="constant.filter-sanitize-string">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-string">FILTER_SANITIZE_STRING</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     This filter strips tags and HTML-encodes double and single quotes.
    </p>
    <p class="simpara">
     Optionally it can strip or encode specified characters if used together with
     the <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     and <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_<span class="replaceable">*</span></a></code></strong>
     filter sanitization flags.
    </p>
    <p class="simpara">
     The behaviour of encoding quotes can be disabled by using the
     <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong> filter flag.
    </p>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="simpara">
      <em>Deprecated</em> as of PHP 8.1.0,
      use <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> instead.
     </p>
    </div>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="simpara">
      The way this filter strips tags is not equivalent to
      <span class="function"><a href="function.strip-tags.php" class="function">strip_tags()</a></span>.
     </p>
    </div>
   </dd>
  
  
   <dt id="constant.filter-sanitize-stripped">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-stripped">FILTER_SANITIZE_STRIPPED</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Псевдонім <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-string">FILTER_SANITIZE_STRING</a></code></strong>.
    </p>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="simpara">
      <em>Deprecated</em> as of PHP 8.1.0,
      use <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> instead.
     </p>
    </div>
   </dd>
  
  
   <dt id="constant.filter-sanitize-encoded">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-encoded">FILTER_SANITIZE_ENCODED</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     This filter URL-encodes a string.
    </p>
    <p class="simpara">
     Optionally it can strip or encode specified characters if used together with
     the <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     and <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_<span class="replaceable">*</span></a></code></strong>
     filter sanitization flags.
    </p>
   </dd>
  
  
   <dt id="constant.filter-sanitize-special-chars">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-special-chars">FILTER_SANITIZE_SPECIAL_CHARS</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="para">
     This filter HTML-encodes
     <span class="simplelist"><code class="literal">&#039;</code>, <code class="literal">&quot;</code>, <code class="literal">&lt;</code>, <code class="literal">&gt;</code>, <code class="literal">&amp;</code></span>
     and characters with an ASCII value less than 32.
     Unlike the <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-full-special-chars">FILTER_SANITIZE_FULL_SPECIAL_CHARS</a></code></strong> filter, the
     <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-special-chars">FILTER_SANITIZE_SPECIAL_CHARS</a></code></strong> filter ignores the
     <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong> flag.
    </p>
    <p class="simpara">
     Optionally it can strip specified characters if used together with
     the <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     filter sanitization flags, and it can encode characters with ASCII value
     greater than 127 using <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-encode-high">FILTER_FLAG_ENCODE_HIGH</a></code></strong>.
    </p>
   </dd>
  
  
   <dt id="constant.filter-sanitize-full-special-chars">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-full-special-chars">FILTER_SANITIZE_FULL_SPECIAL_CHARS</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     This filter is equivalent to calling <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>
     with <strong><code><a href="string.constants.php#constant.ent-quotes">ENT_QUOTES</a></code></strong> set.
    </p>
    <p class="simpara">
     The behaviour of encoding quotes can be disabled by using the
     <strong><code><a href="filter.constants.flags.sanitization.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong> filter flag.
    </p>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="simpara">
      Like <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>, this filter is aware of the
      <a href="ini.core.php#ini.default-charset" class="link">default_charset</a> INI setting.
      If a sequence of bytes is detected that makes up an invalid character
      in the current character set then the entire string is rejected
      resulting in an empty string being returned.
     </p>
    </div>
   </dd>
  
  
   <dt id="constant.filter-sanitize-email">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-email">FILTER_SANITIZE_EMAIL</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Sanitize the string by removing all characters except
     latin letters (<code class="literal">[a-zA-Z]</code>),
     digits (<code class="literal">[0-9]</code>),
     and the special characters
     <code class="literal">!#$%&amp;&#039;*+-=?^_`{|}~@.[]</code>.
    </p>
   </dd>
  
  
   <dt id="constant.filter-sanitize-url">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-url">FILTER_SANITIZE_URL</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Sanitize the string by removing all characters except
     latin letters (<code class="literal">[a-zA-Z]</code>),
     digits (<code class="literal">[0-9]</code>),
     and the special characters
     <code class="literal">$-_.+!*&#039;(),{}|\\^~[]`&lt;&gt;#%&quot;;/?:@&amp;=</code>.
    </p>
   </dd>
  
  
   <dt id="constant.filter-sanitize-number-int">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-number-int">FILTER_SANITIZE_NUMBER_INT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Sanitize the string by removing all characters except digits
     (<code class="literal">[0-9]</code>), plus sign (<code class="literal">+</code>),
     and minus sign (<code class="literal">-</code>).
    </p>
   </dd>
  
  
   <dt id="constant.filter-sanitize-number-float">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-number-float">FILTER_SANITIZE_NUMBER_FLOAT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Sanitize the string by removing all characters except digits
     (<code class="literal">[0-9]</code>), plus sign (<code class="literal">+</code>),
     and minus sign (<code class="literal">-</code>).
    </p>

    <dl id="filter.constants.sanitization.float.flags">
     <strong class="title">Optional Flags</strong>
     
      <dt id="constant.filter-flag-allow-fraction">
       <strong><code><a href="filter.constants.sanitization.php#constant.filter-flag-allow-fraction">FILTER_FLAG_ALLOW_FRACTION</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <p class="simpara">
        Accept dot (<code class="literal">.</code>) character,
        which usually represents the separator between the integer and
        fractional parts.
       </p>
      </dd>
     
     
      <dt id="constant.filter-flag-allow-thousand">
       <strong><code><a href="filter.constants.sanitization.php#constant.filter-flag-allow-thousand">FILTER_FLAG_ALLOW_THOUSAND</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <p class="simpara">
        Accept commas (<code class="literal">,</code>) character,
        which usually represents the thousand separator.
       </p>
      </dd>
     
     
      <dt id="constant.filter-flag-allow-scientific">
       <strong><code><a href="filter.constants.sanitization.php#constant.filter-flag-allow-scientific">FILTER_FLAG_ALLOW_SCIENTIFIC</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <p class="simpara">
        Accept numbers in scientific notation by allowing the
        <code class="literal">e</code> and <code class="literal">E</code> characters.
       </p>
      </dd>
     
    </dl>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="simpara">
      If the <strong><code><a href="filter.constants.sanitization.php#constant.filter-flag-allow-fraction">FILTER_FLAG_ALLOW_FRACTION</a></code></strong> flag is not used,
      then the decimal separator is removed, altering the value received.
     </p>
     <div class="informalexample">
      <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$number </span><span style="color: #007700">= </span><span style="color: #DD0000">'12.34'</span><span style="color: #007700">;

</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">filter_var</span><span style="color: #007700">(</span><span style="color: #0000BB">$number</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_SANITIZE_NUMBER_FLOAT</span><span style="color: #007700">));
</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">filter_var</span><span style="color: #007700">(</span><span style="color: #0000BB">$number</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_SANITIZE_NUMBER_FLOAT</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_FLAG_ALLOW_FRACTION</span><span style="color: #007700">));
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
      </div>

      <p class="para">Поданий вище приклад
виведе:</p>
      <div class="example-contents screen">
<div class="cdata"><pre>
string(4) &quot;1234&quot;
string(5) &quot;12.34&quot;
</pre></div>
      </div>
     </div>
    </div>
   </dd>
  

  
   <dt id="constant.filter-sanitize-add-slashes">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-add-slashes">FILTER_SANITIZE_ADD_SLASHES</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Apply <span class="function"><a href="function.addslashes.php" class="function">addslashes()</a></span> to the input.
     Available as of PHP 7.3.0.
    </p>
   </dd>
  

  
   <dt id="constant.filter-sanitize-magic-quotes">
    <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-magic-quotes">FILTER_SANITIZE_MAGIC_QUOTES</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="simpara">
     Псевдонім <strong><code><a href="filter.constants.sanitization.php#constant.filter-sanitize-add-slashes">FILTER_SANITIZE_ADD_SLASHES</a></code></strong>.
    </p>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="simpara">
      <em>DEPRECATED</em> as of PHP 7.3.0 and
      <em>REMOVED</em> as of PHP 8.0.0.
     </p>
    </div>
   </dd>
  
 </dl>
</div><?php manual_footer($setup); ?>