<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.filter.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'pt_BR',
  ),
  'this' => 
  array (
    0 => 'filter.constants.php',
    1 => 'Constantes predefinidas',
    2 => 'Constantes predefinidas',
  ),
  'up' => 
  array (
    0 => 'book.filter.php',
    1 => 'Filter',
  ),
  'prev' => 
  array (
    0 => 'filter.configuration.php',
    1 => 'Configura&ccedil;&otilde;es em Execu&ccedil;&atilde;o',
  ),
  'next' => 
  array (
    0 => 'filter.examples.php',
    1 => 'Exemplos',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'pt_BR',
    'path' => 'reference/filter/constants.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="filter.constants" class="appendix">
 <h1 class="title">Constantes predefinidas</h1>

 <p class="simpara">
As constantes abaixo são definidas por esta extensão e
só estarão disponíveis quando a extensão tiver sido compilada no PHP
ou tiver sido carregada dinamicamente em tempo de execução.
</p>

 <dl>
  <strong class="title">Constantes de Entrada</strong>
  <p class="simpara">
   Estas constantes são usadas por
   <span class="function"><a href="function.filter-input.php" class="function">filter_input()</a></span> e
   <span class="function"><a href="function.filter-input-array.php" class="function">filter_input_array()</a></span>.
  </p>
  
   <dt id="constant.input-post">
    <strong><code><a href="filter.constants.php#constant.input-post">INPUT_POST</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.post.php" class="link">POST</a>.
    </span>
   </dd>
  
  
   <dt id="constant.input-get">
    <strong><code><a href="filter.constants.php#constant.input-get">INPUT_GET</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.get.php" class="link">GET</a>.
    </span>
   </dd>
  
  
   <dt id="constant.input-cookie">
    <strong><code><a href="filter.constants.php#constant.input-cookie">INPUT_COOKIE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.cookies.php" class="link">COOKIE</a>.
    </span>
   </dd>
  
  
   <dt id="constant.input-env">
    <strong><code><a href="filter.constants.php#constant.input-env">INPUT_ENV</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.environment.php" class="link">ENV</a>.
    </span>
   </dd>
  
  
   <dt id="constant.input-server">
    <strong><code><a href="filter.constants.php#constant.input-server">INPUT_SERVER</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.server.php" class="link">SERVER</a>.
    </span>
   </dd>
  
  
   <dt id="constant.input-session">
    <strong><code><a href="filter.constants.php#constant.input-session">INPUT_SESSION</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.session.php" class="link">SESSION</a>.
     (Removida a partir do PHP 8.0.0; não estava implementada anteriormente)
    </span>
   </dd>
  
  
   <dt id="constant.input-request">
    <strong><code><a href="filter.constants.php#constant.input-request">INPUT_REQUEST</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Variáveis <a href="reserved.variables.request.php" class="link">REQUEST</a>.
     (Removida a partir do PHP 8.0.0; não estava implementada anteriormente)
    </span>
   </dd>
  
 </dl>

 <dl id="filter.constants.flags.generic">
  <strong class="title">Opções Genéricas de Filtros</strong>
  
   <dt id="constant.filter-flag-none">
    <strong><code><a href="filter.constants.php#constant.filter-flag-none">FILTER_FLAG_NONE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Sem flags.
    </span>
   </dd>
  
  
   <dt id="constant.filter-require-scalar">
    <strong><code><a href="filter.constants.php#constant.filter-require-scalar">FILTER_REQUIRE_SCALAR</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Opção usada para requerer que a entrada do filtro seja um escalar.
    </span>
   </dd>
  
  
   <dt id="constant.filter-require-array">
    <strong><code><a href="filter.constants.php#constant.filter-require-array">FILTER_REQUIRE_ARRAY</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
      Opção usada para requerer que a entrada do filtro seja um <span class="type"><a href="language.types.array.php" class="type array">array</a></span>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-force-array">
    <strong><code><a href="filter.constants.php#constant.filter-force-array">FILTER_FORCE_ARRAY</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Esta opção encapsula entradas encalares em um <span class="type"><a href="language.types.array.php" class="type array">array</a></span> de um elemento
     para filtros que operam em arrays.
    </span>
   </dd>
  
  
   <dt id="constant.filter-null-on-failure">
    <strong><code><a href="filter.constants.php#constant.filter-null-on-failure">FILTER_NULL_ON_FAILURE</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Usa <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> ao invés de <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> em caso de falha.
    </span>
    <span class="simpara">
     Utilizável com qualquer filtro
     <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_<span class="replaceable">*</span></a></code></strong>
     de validação.
    </span>
   </dd>
  
 </dl>

 <dl id="filter.constants.flags.sanitization">
  <strong class="title">Opções de Filtro de Sanitização</strong>
  
   <dt id="constant.filter-flag-strip-low">
    <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_LOW</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Remove caracteres com valor ASCII menor que 32.
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-strip-high">
    <strong><code><a href="filter.constants.php#constant.filter-flag-strip-high">FILTER_FLAG_STRIP_HIGH</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Remove caracteres com valor ASCII maior que 127.
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-strip-backtick">
    <strong><code><a href="filter.constants.php#constant.filter-flag-strip-backtick">FILTER_FLAG_STRIP_BACKTICK</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Remove caracteres de acento grave (<code class="literal">`</code>).
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-encode-low">
    <strong><code><a href="filter.constants.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_LOW</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Codifica caracteres com valor ASCII menor que 32.
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-encode-high">
    <strong><code><a href="filter.constants.php#constant.filter-flag-encode-high">FILTER_FLAG_ENCODE_HIGH</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Codifica caracteres com valor ASCII maior que 127.
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-encode-amp">
    <strong><code><a href="filter.constants.php#constant.filter-flag-encode-amp">FILTER_FLAG_ENCODE_AMP</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Codifica <code class="literal">&amp;</code>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-no-encode-quotes">
    <strong><code><a href="filter.constants.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Não codifica aspas simples e duplas (<code class="literal">&#039;</code>
     e <code class="literal">&quot;</code>).
    </span>
   </dd>
  
  
   <dt id="constant.filter-flag-empty-string-null">
    <strong><code><a href="filter.constants.php#constant.filter-flag-empty-string-null">FILTER_FLAG_EMPTY_STRING_NULL</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     
     Se a sanitização de uma string resultar em uma string vazia,
     converte o valor para <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>.
    </span>
   </dd>
  
 </dl>

 <dl id="filter.constants.validation">
  <strong class="title">Filtros de Validação</strong>

  
   <dt id="constant.filter-validate-bool">
    <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_BOOL</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Retorna <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> para <code class="literal">&quot;1&quot;</code>,
     <code class="literal">1</code> incluindo as notações binária, octal e hexadecimal, <code class="literal">1.0</code>,
     <code class="literal">&quot;true&quot;</code>, <code class="literal">true</code>,
     <code class="literal">&quot;on&quot;</code>
     e <code class="literal">&quot;yes&quot;</code>.
    </span>
    <span class="simpara">
     Retorna <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> para <code class="literal">&quot;0&quot;</code>,
     <code class="literal">0</code> incluindo as notações binária, octal e hexadecimal, <code class="literal">0.0</code>,
     <code class="literal">&quot;false&quot;</code>, <code class="literal">false</code>,
     <code class="literal">&quot;off&quot;</code>,
     <code class="literal">&quot;no&quot;</code> e
     <code class="literal">&quot;&quot;</code>.
    </span>
    <span class="simpara">
     Valores string são comparados de forma insensível a maiúsculas/minúsculas.
     O valor de retorno para valores não booleanos depende da opção
     <strong><code><a href="filter.constants.php#constant.filter-null-on-failure">FILTER_NULL_ON_FAILURE</a></code></strong>.
     Se estiver definida, retorna <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, caso contrário, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
    </span>
    <dl id="filter.constants.validation.bool.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
    </dl>
    <span class="simpara">
     Disponível a partir do PHP 8.0.0.
    </span>
   </dd>
  

  
   <dt id="constant.filter-validate-boolean">
    <strong><code><a href="filter.constants.php#constant.filter-validate-boolean">FILTER_VALIDATE_BOOLEAN</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Sinônimo de <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_BOOL</a></code></strong>.
     O sinônimo estava disponível antes da introdução de seu nome canônico
     no PHP 8.0.0.
    </span>
   </dd>
  

  
   <dt id="constant.filter-validate-int">
    <strong><code><a href="filter.constants.php#constant.filter-validate-int">FILTER_VALIDATE_INT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Valida se o valor é um inteiro,
     em caso de sucesso é convertido para o tipo <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
    </span>

    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      Valores string são aparados usando <span class="function"><a href="function.trim.php" class="function">trim()</a></span>
      antes da validação.
     </span>
    </p></blockquote>

    <dl id="filter.constants.validation.int.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
     
      <dt><code class="literal">min_range</code></dt>
      <dd>
       <span class="simpara">
        Valor só é válido se for maior ou igual que o valor fornecido.
       </span>
      </dd>
     
     
      <dt><code class="literal">max_range</code></dt>
      <dd>
       <span class="simpara">
        Valor só é válido se for menor ou igual que o valor fornecido.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.int.flags">
     <strong class="title">Constantes Opcionais</strong>
     
      <dt id="constant.filter-flag-allow-octal">
       <strong><code><a href="filter.constants.php#constant.filter-flag-allow-octal">FILTER_FLAG_ALLOW_OCTAL</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        
         Permite inteiros em notação octal
        (<code class="literal">0[0-7]+</code>).
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-allow-hex">
       <strong><code><a href="filter.constants.php#constant.filter-flag-allow-hex">FILTER_FLAG_ALLOW_HEX</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Permite inteiros em notação hexadecimal
        (<code class="literal">0x[0-9a-fA-F]+</code>).
       </span>
      </dd>
     
    </dl>
   </dd>
  

  
   <dt id="constant.filter-validate-float">
    <strong><code><a href="filter.constants.php#constant.filter-validate-float">FILTER_VALIDATE_FLOAT</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Valida se o valor é um float,
     em caso de sucesso é convertido para o tipo <span class="type"><a href="language.types.float.php" class="type float">float</a></span>.
    </span>

    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      Valores string são aparados usando <span class="function"><a href="function.trim.php" class="function">trim()</a></span>
      antes da validação.
     </span>
    </p></blockquote>

    <dl id="filter.constants.validation.float.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
     
      <dt><code class="literal">decimal</code></dt>
      <dd>
       <span class="simpara">
        
       </span>
      </dd>
     
     
      <dt><code class="literal">min_range</code></dt>
      <dd>
       <span class="simpara">
        Valor só é válido se for maior ou igual que o valor fornecido.
        Disponível a partir do PHP 7.4.0.
       </span>
      </dd>
     
     
      <dt><code class="literal">max_range</code></dt>
      <dd>
       <span class="simpara">
        Valor só é válido se for menor ou igual que o valor fornecido.
        Disponível a partir do PHP 7.4.0.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.float.flags">
     <strong class="title">Constantes opcionais</strong>
     
      <dt>
       <strong><code><a href="filter.constants.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>
       <span class="simpara">
        Aceita vírgulas (<code class="literal">,</code>),
        que normalmente representam separador de milhares em inglês.
       </span>
      </dd>
     
    </dl>
   </dd>
  
  
   <dt id="constant.filter-validate-regexp">
    <strong><code><a href="filter.constants.php#constant.filter-validate-regexp">FILTER_VALIDATE_REGEXP</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Valida o valor comparando com a expressão regular informada pela opção
     <code class="literal">regexp</code>.
    </span>

    <dl id="filter.constants.validation.regex.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
     
      <dt><code class="literal">regexp</code></dt>
      <dd>
       <span class="simpara">
        Expressão regular <a href="book.pcre.php" class="link">compatível com Perl</a>.
       </span>
      </dd>
     
    </dl>
   </dd>
  

  
   <dt id="constant.filter-validate-url">
    <strong><code><a href="filter.constants.php#constant.filter-validate-url">FILTER_VALIDATE_URL</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Verifica se o <abbr title="Uniform Resource Locator">URL</abbr> é válido conforme a
     <a href="https://datatracker.ietf.org/doc/html/rfc2396" class="link external">&raquo;&nbsp;RFC 2396</a>.
    </span>
    <dl id="filter.constants.validation.url.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.url.flags">
     <strong class="title">Constantes Opcionais</strong>
     
      <dt id="constant.filter-flag-scheme-required">
       <strong><code><a href="filter.constants.php#constant.filter-flag-scheme-required">FILTER_FLAG_SCHEME_REQUIRED</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Requer que o <abbr title="Uniform Resource Locator">URL</abbr> contenha uma parte de esquema.
       </span>
       <div class="warning"><strong class="warning">Aviso</strong>
        <p class="simpara">
         <em>DESCONTINUADA</em> a partir do PHP 7.3.0 e
         <em>REMOVIDA</em> a partir do PHP 8.0.0.
         A razão é que fica sempre implícita pelo filtro
         <strong><code><a href="filter.constants.php#constant.filter-validate-url">FILTER_VALIDATE_URL</a></code></strong>.
        </p>
       </div>
      </dd>
     
     
      <dt id="constant.filter-flag-host-required">
       <strong><code><a href="filter.constants.php#constant.filter-flag-host-required">FILTER_FLAG_HOST_REQUIRED</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Requer que o <abbr title="Uniform Resource Locator">URL</abbr> contenha uma parte de host.
       </span>
       <div class="warning"><strong class="warning">Aviso</strong>
        <p class="simpara">
         <em>DESCONTINUADA</em> a partir do PHP 7.3.0 e
         <em>REMOVIDA</em> a partir do PHP 8.0.0.
         A razão é que fica sempre implícita pelo filtro
         <strong><code><a href="filter.constants.php#constant.filter-validate-url">FILTER_VALIDATE_URL</a></code></strong>.
        </p>
       </div>
      </dd>
     
     
      <dt id="constant.filter-flag-path-required">
       <strong><code><a href="filter.constants.php#constant.filter-flag-path-required">FILTER_FLAG_PATH_REQUIRED</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Requer que o <abbr title="Uniform Resource Locator">URL</abbr> contenha uma parte de caminho.
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-query-required">
       <strong><code><a href="filter.constants.php#constant.filter-flag-query-required">FILTER_FLAG_QUERY_REQUIRED</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Requer que o <abbr title="Uniform Resource Locator">URL</abbr> contenha uma parte de consulta.
       </span>
      </dd>
     
    </dl>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      Um <abbr title="Uniform Resource Locator">URL</abbr> válido pode não especificar o
      protocolo <abbr title="Hypertext Transfer Protocol">HTTP</abbr> (<code class="literal">http://</code>).
      Portanto, uma validação adicional pode ser necessária para determinar se o
      <abbr title="Uniform Resource Locator">URL</abbr> usa um protocolo esperado,
      por exemplo, <code class="literal">ssh://</code> ou <code class="literal">mailto:</code>.
     </p>
    </div>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      Este filtro só funciona em <abbr title="Uniform Resource Locator">URL</abbr>s <abbr title="American Standard Code for Information Interchange">ASCII</abbr>.
      Isto significa que os Nomes de Domínio Internacionalizados (IDN) serão sempre rejeitados.
     </p>
    </div>
   </dd>
  
  
   <dt id="constant.filter-validate-domain">
    <strong><code><a href="filter.constants.php#constant.filter-validate-domain">FILTER_VALIDATE_DOMAIN</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Valida se o nome de domínio é válido de acordo com
     <a href="https://datatracker.ietf.org/doc/html/rfc952" class="link external">&raquo;&nbsp;RFC 952</a>,
     <a href="https://datatracker.ietf.org/doc/html/rfc1034" class="link external">&raquo;&nbsp;RFC 1034</a>,
     <a href="https://datatracker.ietf.org/doc/html/rfc1035" class="link external">&raquo;&nbsp;RFC 1035</a>,
     <a href="https://datatracker.ietf.org/doc/html/rfc1034" class="link external">&raquo;&nbsp;RFC 1123</a>,
     <a href="https://datatracker.ietf.org/doc/html/rfc1034" class="link external">&raquo;&nbsp;RFC 2732</a>,
     e
     <a href="https://datatracker.ietf.org/doc/html/rfc2181" class="link external">&raquo;&nbsp;RFC 2181</a>.
    </span>
    <dl id="filter.constants.validation.domain.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.domain.flags">
     <strong class="title">Constantes Opcionais</strong>
     
      <dt id="constant.filter-flag-hostname">
       <strong><code><a href="filter.constants.php#constant.filter-flag-hostname">FILTER_FLAG_HOSTNAME</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Requer que hostnames iniciem com caracteres alfanuméricos e contenham
        apenas caracteres alfanuméricos ou hífen.
       </span>
      </dd>
     
    </dl>
   </dd>
  
  
   <dt id="constant.filter-validate-email">
    <strong><code><a href="filter.constants.php#constant.filter-validate-email">FILTER_VALIDATE_EMAIL</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Verifica se o valor é um endereço válido de e-mail.
    </span>

    <span class="simpara">
     A validação é realizada conforme a sintaxe <code class="literal">addr-spec</code>
     na
     <a href="https://datatracker.ietf.org/doc/html/rfc822" class="link external">&raquo;&nbsp;RFC 822</a>.
     Contudo, comentários, espaços em branco e domínios sem ponto
     não são suportados, e por isso serão rejeitados.
    </span>

    <dl id="filter.constants.validation.email.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.email.flags">
     <strong class="title">Constantes Opcionais</strong>
     
      <dt id="constant.filter-flag-email-unicode">
       <strong><code><a href="filter.constants.php#constant.filter-flag-email-unicode">FILTER_FLAG_EMAIL_UNICODE</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Aceita caracteres Unicode na parte local.
        Disponível a partir do PHP 7.1.0.
       </span>
      </dd>
     
    </dl>

    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      A validação de e-mail é complexa e a única maneira verdadeira de confirmar se um e-mail
      é válido e existe é enviando um e-mail para o endereço.
     </p>
    </div>
   </dd>
  

  
   <dt id="constant.filter-validate-ip">
    <strong><code><a href="filter.constants.php#constant.filter-validate-ip">FILTER_VALIDATE_IP</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <p class="para">
     Valida o valor como um endereço IP.
    </p>
    <dl id="filter.constants.validation.ip.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.ip.flags">
     <strong class="title">Constantes Opcionais</strong>
     
      <dt id="constant.filter-flag-ipv4">
       <strong><code><a href="filter.constants.php#constant.filter-flag-ipv4">FILTER_FLAG_IPV4</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Permite endereço IPv4.
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-ipv6">
       <strong><code><a href="filter.constants.php#constant.filter-flag-ipv6">FILTER_FLAG_IPV6</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Permite endereço IPv6.
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-no-res-range">
       <strong><code><a href="filter.constants.php#constant.filter-flag-no-res-range">FILTER_FLAG_NO_RES_RANGE</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Nega endereços reservados.
       </span>
       <span class="simpara">
        Estes são os intervalos marcados como
        <code class="literal">Reserved-By-Protocol</code> (reservados por protocolo) na
        <a href="https://datatracker.ietf.org/doc/html/rfc6890" class="link external">&raquo;&nbsp;RFC 6890</a>.
       </span>
       <p class="para">
        Para IPv4, corresponden aos seguintes intervalos:
        <span class="simplelist"><code class="literal">0.0.0.0/8</code>, <code class="literal">169.254.0.0/16</code>, <code class="literal">127.0.0.0/8</code>, <code class="literal">240.0.0.0/4</code></span>.
       </p>
       <p class="para">
        E para IPv6, corresponden aos seguintes intervalos:
        <span class="simplelist"><code class="literal">::1/128</code>, <code class="literal">::/128</code>, <code class="literal">::FFFF:0:0/96</code>, <code class="literal">FE80::/10</code></span>.
       </p>
      </dd>
     
     
      <dt id="constant.filter-flag-no-priv-range">
       <strong><code><a href="filter.constants.php#constant.filter-flag-no-priv-range">FILTER_FLAG_NO_PRIV_RANGE</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Nega endereços privados.
       </span>
       <p class="para">
        São os endereços IPv4 que estão nestas faixas:
        <span class="simplelist"><code class="literal">10.0.0.0/8</code>, <code class="literal">172.16.0.0/12</code>, <code class="literal">192.168.0.0/16</code></span>.
       </p>
       <span class="simpara">
        E são os endereços IPv6 que inicial com
        <code class="literal">FD</code> ou <code class="literal">FC</code>.
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-global-range">
       <strong><code><a href="filter.constants.php#constant.filter-flag-global-range">FILTER_FLAG_GLOBAL_RANGE</a></code></strong>
       (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
      </dt>
      <dd>
       <span class="simpara">
        Permite apenas endereços globais.
        Podem ser encontrados na
        <a href="https://datatracker.ietf.org/doc/html/rfc6890" class="link external">&raquo;&nbsp;RFC 6890</a>
        onde o atributo <code class="literal">Global</code> é <code class="literal">True</code>.
        Disponível a partir do PHP 8.2.0.
       </span>
      </dd>
     
    </dl>
   </dd>
  

  
   <dt id="constant.filter-validate-mac">
    <strong><code><a href="filter.constants.php#constant.filter-validate-mac">FILTER_VALIDATE_MAC</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Valida se o valor é um endereço MAC.
    </span>

    <dl id="filter.constants.validation.mac.options">
     <strong class="title">Opções disponíveis</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valor a retornar caso o filtro falhe.
       </span>
      </dd>
     
    </dl>
   </dd>
  
 </dl>

 <dl id="filter.constants.sanitization">
  <strong class="title">Filtros de Sanitização</strong>
  
   <dt id="constant.filter-unsafe-raw">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Este filtro não faz nada.
    </span>
    <span class="simpara">
     Entretanto, ele pode remover ou codificar caracteres especiais se usado em conjunto com
     as opções <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     e <strong><code><a href="filter.constants.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_<span class="replaceable">*</span></a></code></strong>
     de filtro de sanitização.
    </span>
   </dd>
  
  
   <dt id="constant.filter-default">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Sinônimo de <strong><code><a href="filter.constants.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-sanitize-string">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Este filtro remove etiquetas e codifica HTML com aspas duplas e simples.
    </span>
    <span class="simpara">
     Opcionalmente, ele pode remover ou codificar caracteres especificados se usado junto
     com as opções de filtro de sanitização
     <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     e <strong><code><a href="filter.constants.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_<span class="replaceable">*</span></a></code></strong>.
    </span>
    <span class="simpara">
     O comportamento da codificação de aspas pode ser desativado usando a
     opção de filtro <strong><code><a href="filter.constants.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong>
    </span>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      <em>Descontinuado</em> a partir do PHP 8.1.0,
      use <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> em seu lugar.
     </p>
    </div>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      A maneira como esse filtro remove as etiquetas não é equivalente a
      <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.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>
    <span class="simpara">
     Sinônimo de <strong><code><a href="filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_STRING</a></code></strong>.
    </span>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      <em>Descontinuado</em> a partir do PHP 8.1.0,
      use <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> em seu lugar.
     </p>
    </div>
   </dd>
  
  
   <dt id="constant.filter-sanitize-encoded">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Este filtra codifica uma string em URL.
    </span>
    <span class="simpara">
     Opcionalmente pode codificar caracteres especificados se usado junto com
     as opções de filtro de sanitização
     <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
     e <strong><code><a href="filter.constants.php#constant.filter-flag-encode-low">FILTER_FLAG_ENCODE_<span class="replaceable">*</span></a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-sanitize-special-chars">
    <strong><code><a href="filter.constants.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">
     Este filtra codifica, em HTML,
     <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>
     e caracteres com um valor ASCII menor que 32.
     Diferentemente do filtro <strong><code><a href="filter.constants.php#constant.filter-sanitize-full-special-chars">FILTER_SANITIZE_FULL_SPECIAL_CHARS</a></code></strong>, o filtro
     <strong><code><a href="filter.constants.php#constant.filter-sanitize-special-chars">FILTER_SANITIZE_SPECIAL_CHARS</a></code></strong> ignora a opção
     <strong><code><a href="filter.constants.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong>.
    </p>
    <span class="simpara">
     Opcionalmente pode codificar caracteres especificados se usado junto com
     as opções de filtro de sanitização <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>,
     e pode codificar caracteres com valores ASCII
     maiores que 127 usando <strong><code><a href="filter.constants.php#constant.filter-flag-encode-high">FILTER_FLAG_ENCODE_HIGH</a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-sanitize-full-special-chars">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Este filtro é equivalente a chamar <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>
     com <strong><code><a href="string.constants.php#constant.ent-quotes">ENT_QUOTES</a></code></strong> definida.
    </span>
    <span class="simpara">
     O comportamento da codificação de aspas pode ser desabilitado usando a
     opção de filtro <strong><code><a href="filter.constants.php#constant.filter-flag-no-encode-quotes">FILTER_FLAG_NO_ENCODE_QUOTES</a></code></strong>.
    </span>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      Assim como <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>, este filtro reconhece a
      configuração INI <a href="ini.core.php#ini.default-charset" class="link">default_charset</a>.
      Se for detectada uma sequência de bytes que constitui um caractere inválido
      no conjunto de caracteres atual, a string inteira será rejeitada,
      resultando no retorno de uma string vazia.
     </p>
    </div>
   </dd>
  
  
   <dt id="constant.filter-sanitize-email">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Sanitiza a string removendo todos os caracteres exceto
     as letras latinas (<code class="literal">[a-zA-Z]</code>),
     dígitos (<code class="literal">[0-9]</code>)
     e os caracteres especiais
     <code class="literal">!#$%&amp;&#039;*+-=?^_`{|}~@.[]</code>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-sanitize-url">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Sanitiza a string removendo todos os caracteres exceto
     as letras latinas (<code class="literal">[a-zA-Z]</code>),
     dígitos (<code class="literal">[0-9]</code>)
     e os caracteres especiais
     <code class="literal">$-_.+!*&#039;(),{}|\\^~[]`&lt;&gt;#%&quot;;/?:@&amp;=</code>.
    </span>
   </dd>
  
  
   <dt id="constant.filter-sanitize-number-int">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Sanitiza a string removendo todos os caracteres exceto
     (<code class="literal">[0-9]</code>), sinal de adição (<code class="literal">+</code>),
     e sinal de subtração (<code class="literal">-</code>).
    </span>
   </dd>
  
  
   <dt id="constant.filter-sanitize-number-float">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Sanitiza a string removendo todos os caracteres exceto
     (<code class="literal">[0-9]</code>), sinal de adição (<code class="literal">+</code>),
     e sinal de subtração (<code class="literal">-</code>).
    </span>

    <dl id="filter.constants.sanitization.float.flags">
     <strong class="title">Constantes Opcionais</strong>
     
      <dt id="constant.filter-flag-allow-fraction">
       <strong><code><a href="filter.constants.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>
       <span class="simpara">
        Aceita o caractere ponto (<code class="literal">.</code>),
        que normalmente representa o separador entre as partes inteira
        e fracionária em inglês.
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-allow-thousand">
       <strong><code><a href="filter.constants.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>
       <span class="simpara">
        Aceita vírgulas (<code class="literal">,</code>),
        que normalmente representam separador de milhares em inglês.
       </span>
      </dd>
     
     
      <dt id="constant.filter-flag-allow-scientific">
       <strong><code><a href="filter.constants.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>
       <span class="simpara">
        Aceita números em notação científica permitindo os caracteres
        <code class="literal">e</code> e <code class="literal">E</code>.
       </span>
      </dd>
     
    </dl>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      Se a opção <strong><code><a href="filter.constants.php#constant.filter-flag-allow-fraction">FILTER_FLAG_ALLOW_FRACTION</a></code></strong> não for usada,
      o separador de decimais será removido, alterando o valor recebido.
     </p>
     <div class="informalexample">
      <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$number </span><span style="color: #007700">= </span><span style="color: #DD0000">'12.34'</span><span style="color: #007700">;<br /><br /></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">));<br /></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">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
      </div>

      <p class="para">O exemplo acima produzirá:</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.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>
    <span class="simpara">
     Aplica <span class="function"><a href="function.addslashes.php" class="function">addslashes()</a></span> à entrada.
     Disponível a partir do PHP 7.3.0.
    </span>
   </dd>
  

  
   <dt id="constant.filter-sanitize-magic-quotes">
    <strong><code><a href="filter.constants.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>
    <span class="simpara">
     Sinônimo de <strong><code><a href="filter.constants.php#constant.filter-sanitize-add-slashes">FILTER_SANITIZE_ADD_SLASHES</a></code></strong>.
    </span>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      <em>DESCONTINUADA</em> a partir do PHP 7.3.0 e
      <em>REMOVIDA</em> a partir do PHP 8.0.0.
     </p>
    </div>
   </dd>
  
 </dl>

 <dl>
  <strong class="title">Filtro Definido pelo Usuário</strong>
  
   <dt id="constant.filter-callback">
    <strong><code><a href="filter.constants.php#constant.filter-callback">FILTER_CALLBACK</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Este filtro delega a filtragem a uma função definida pelo usuário.
     O <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> é passado através do
     parâmetro <code class="parameter">options</code> comom o valor associado à
     chave <code class="literal">&#039;options&#039;</code>.
    </span>
    <p class="para">
     A função deve ter a seguinte assinatura:
     <div class="methodsynopsis dc-description">
      <span class="methodname"><span class="replaceable">callback</span></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>

     <dl>
      
       <dt><code class="parameter">value</code></dt>
       <dd>
        <span class="simpara">
         O valor a ser filtrado.
        </span>
       </dd>
      
     </dl>
    </p>
    <blockquote class="note"><p><strong class="note">Nota</strong>: 
     <span class="simpara">
      O valor retornado pela função será o valor retornado pela
      função de filtro chamada.
     </span>
    </p></blockquote>
    <div class="example" id="example-1">
     <p><strong>Exemplo #1 
      Exemplo de uso de <strong><code><a href="filter.constants.php#constant.filter-callback">FILTER_CALLBACK</a></code></strong> para validar
      um login
     </strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">validate_login</span><span style="color: #007700">(</span><span style="color: #0000BB">string $value</span><span style="color: #007700">): ?</span><span style="color: #0000BB">string<br /></span><span style="color: #007700">{<br />    if (</span><span style="color: #0000BB">strlen</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">) &gt;= </span><span style="color: #0000BB">5 </span><span style="color: #007700">&amp;&amp; </span><span style="color: #0000BB">ctype_alnum</span><span style="color: #007700">(</span><span style="color: #0000BB">$value</span><span style="color: #007700">)) {<br />        return </span><span style="color: #0000BB">$value</span><span style="color: #007700">;<br />    }<br />    return </span><span style="color: #0000BB">null</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #0000BB">$login </span><span style="color: #007700">= </span><span style="color: #DD0000">"L0ginValido"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$filtered_login </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_var</span><span style="color: #007700">(</span><span style="color: #0000BB">$login</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_CALLBACK</span><span style="color: #007700">, [</span><span style="color: #DD0000">'options' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'validate_login'</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$filtered_login</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$login </span><span style="color: #007700">= </span><span style="color: #DD0000">"login f&amp;lso"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$filtered_login </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_var</span><span style="color: #007700">(</span><span style="color: #0000BB">$login</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_CALLBACK</span><span style="color: #007700">, [</span><span style="color: #DD0000">'options' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'validate_login'</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$filtered_login</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

     <div class="example-contents"><p>O exemplo acima produzirá:</p></div>
     <div class="example-contents screen">
<div class="cdata"><pre>
string(11) &quot;L0ginValido&quot;
NULL
</pre></div>
     </div>
    </div>
    <div class="warning"><strong class="warning">Aviso</strong>
     <p class="simpara">
      Este filtro não pode ser usado com nenhuma outra opção de filtro, como por exemplo,
      <strong><code><a href="filter.constants.php#constant.filter-null-on-failure">FILTER_NULL_ON_FAILURE</a></code></strong>.
     </p>
    </div>
   </dd>
  
 </dl>
</div>
<?php manual_footer($setup); ?>