<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'filter.constants.php',
    1 => 'Constantes pr&eacute;-d&eacute;finies',
    2 => 'Constantes pr&eacute;-d&eacute;finies',
  ),
  'up' => 
  array (
    0 => 'book.filter.php',
    1 => 'Filter',
  ),
  'prev' => 
  array (
    0 => 'filter.configuration.php',
    1 => 'Configuration &agrave; l\'ex&eacute;cution',
  ),
  'next' => 
  array (
    0 => 'filter.examples.php',
    1 => 'Exemples',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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 pré-définies</h1>

 <p class="simpara">Ces constantes sont définies par cette
extension, et ne sont disponibles que si cette extension a été compilée avec
PHP, ou bien chargée au moment de l&#039;exécution.</p>
 <dl>
  <strong class="title">Constantes d&#039;Entrée</strong>
  <p class="simpara">
   Ces constantes sont utilisées par
   <span class="function"><a href="function.filter-input.php" class="function">filter_input()</a></span> et
   <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">
     Variables <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">
     Variables <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">
     Variables <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">
     Variables <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">
     Variables <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">
     Variables <a href="reserved.variables.session.php" class="link">SESSION</a>.
     (Supprimé à partir de PHP 8.0.0 ; n&#039;a pas été implémenté précédemment)
    </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">
     Variables <a href="reserved.variables.request.php" class="link">REQUEST</a>.
     (Supprimé à partir de PHP 8.0.0 ; n&#039;a pas été implémenté précédemment)
    </span>
   </dd>
  
 </dl>

 <dl id="filter.constants.flags.generic">
  <strong class="title">Drapeaux Généraux de Filtrage</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">
     Aucun drapeau.
    </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">
     Drapeau utilisé pour exiger que l&#039;entrée du filtre soit un scalaire.
    </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">
     Drapeau utilisé pour exiger que l&#039;entrée du filtre soit un <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">
     Ce drapeau enveloppe les entrées scalaires dans un <span class="type"><a href="language.types.array.php" class="type array">array</a></span> d&#039;un élément
     pour les filtres qui opèrent sur des tableaux.
    </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">
     Utilise <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> au lieu de <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> en cas d&#039;échec.
    </span>
    <span class="simpara">
     Utilisable avec tout filtre de validation
     <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_<span class="replaceable">*</span></a></code></strong>.
    </span>
   </dd>
  
 </dl>

 <dl id="filter.constants.flags.sanitization">
  <strong class="title">Drapeaux de Filtrage de Sanitation</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">
     Supprime les caractères ayant une valeur ASCII inférieure à 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">
     Supprime les caractères ayant une valeur ASCII supérieure à 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">
     Supprime les caractères backtick (<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">
     Encode les caractères ayant une valeur ASCII inférieure à 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">
     Encode les caractères ayant une valeur ASCII supérieure à 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">
     Encode <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">
     Les guillemets simples et doubles (<code class="literal">&#039;</code> et <code class="literal">&quot;</code>)
     ne sont pas encodés.
    </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">
     
     Si la sanitation d&#039;une chaîne de caractères aboutit à une chaîne vide,
     convertir la valeur en <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>
    </span>
   </dd>
  
 </dl>
 <dl id="filter.constants.validation">
  <strong class="title">Filtres de Validation</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">
     Retourne <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> pour <code class="literal">&quot;1&quot;</code>,
     <code class="literal">1</code>, y compris les notations binaire, octale et hexadécimale, <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>,
     et <code class="literal">&quot;yes&quot;</code>.
    </span>
    <span class="simpara">
     Retourne <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> pour <code class="literal">&quot;0&quot;</code>,
     <code class="literal">0</code>, y compris les notations binaire, octale et hexadécimale, <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>, et
     <code class="literal">&quot;&quot;</code>.
    </span>
    <span class="simpara">
     Les valeurs de type chaîne sont comparées sans tenir compte de la casse.
     La valeur retournée pour des valeurs non booléennes dépend de
     <strong><code><a href="filter.constants.php#constant.filter-null-on-failure">FILTER_NULL_ON_FAILURE</a></code></strong>.
     Si ce dernier est défini, <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> est retourné, sinon <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> est retourné.
    </span>
    <dl id="filter.constants.validation.bool.options">
     <strong class="title">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner si le filtre échoue.
       </span>
      </dd>
     
    </dl>
    <span class="simpara">
     Disponible à partir de 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">
     Alias de <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_BOOL</a></code></strong>.
     Cet alias était disponible avant l&#039;introduction de son nom canonique
     dans 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">
     Valide si la valeur est un entier,
     en cas de succès, elle est convertie en type <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
    </span>

    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <span class="simpara">
      Les chaînes de caractères sont nettoyées à l&#039;aide de <span class="function"><a href="function.trim.php" class="function">trim()</a></span>
      avant validation.
     </span>
    </p></blockquote>

    <dl id="filter.constants.validation.int.options">
     <strong class="title">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner si le filtre échoue.
       </span>
      </dd>
     
     
      <dt><code class="literal">min_range</code></dt>
      <dd>
       <span class="simpara">
        La valeur est valide seulement si elle est supérieure ou égale à la valeur fournie.
       </span>
      </dd>
     
     
      <dt><code class="literal">max_range</code></dt>
      <dd>
       <span class="simpara">
        La valeur est valide seulement si elle est inférieure ou égale à la valeur fournie.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.int.flags">
     <strong class="title">Options facultatives</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">
        
        Permet les entiers en notation octale
        (<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">
        Permet les entiers en notation hexadécimale
        (<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">
     Valide si la valeur est un nombre flottant,
     en cas de succès, elle est convertie en type <span class="type"><a href="language.types.float.php" class="type float">float</a></span>.
    </span>

    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <span class="simpara">
      Les chaînes de caractères sont nettoyées à l&#039;aide de <span class="function"><a href="function.trim.php" class="function">trim()</a></span>
      avant validation.
     </span>
    </p></blockquote>

    <dl id="filter.constants.validation.float.options">
     <strong class="title">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner si le filtre échoue.
       </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">
        La valeur est valide seulement si elle est supérieure ou égale à la valeur fournie.
        Disponible à partir de PHP 7.4.0.
       </span>
      </dd>
     
     
      <dt><code class="literal">max_range</code></dt>
      <dd>
       <span class="simpara">
        La valeur est valide seulement si elle est inférieure ou égale à la valeur fournie.
        Disponible à partir de PHP 7.4.0.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.float.flags">
     <strong class="title">Options facultatives</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">
        Accepte les virgules (<code class="literal">,</code>),
        qui représentent généralement le séparateur de milliers.
       </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">
     Valide la valeur en fonction de l&#039;expression régulière fournie par l&#039;option
     <code class="literal">regexp</code>.
    </span>

    <dl id="filter.constants.validation.regex.options">
     <strong class="title">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner si le filtre échoue.
       </span>
      </dd>
     
     
      <dt><code class="literal">regexp</code></dt>
      <dd>
       <span class="simpara">
        Expression régulière compatible <a href="book.pcre.php" class="link">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">
     Valide si l&#039;<abbr title="Uniform Resource Locator">URL</abbr> est valide selon
     <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">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner si le filtre échoue.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.url.flags">
     <strong class="title">Options facultatives</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">
        Exige que l&#039;<abbr title="Uniform Resource Locator">URL</abbr> contienne une partie schéma.
       </span>
       <div class="warning"><strong class="warning">Avertissement</strong>
        <p class="simpara">
         <em>OBSOLÈTE</em> à partir de PHP 7.3.0 et
         <em>SUPPRIMÉ</em> à partir de PHP 8.0.0.
         Cela est dû au fait qu&#039;il est toujours implicite avec
         le filtre <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">
        Exige que l&#039;<abbr title="Uniform Resource Locator">URL</abbr> contienne une partie hôte.
       </span>
       <div class="warning"><strong class="warning">Avertissement</strong>
        <p class="simpara">
         <em>OBSOLÈTE</em> à partir de PHP 7.3.0 et
         <em>SUPPRIMÉ</em> à partir de PHP 8.0.0.
         Cela est dû au fait qu&#039;il est toujours implicite avec
         le filtre <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">
        Exige que l&#039;<abbr title="Uniform Resource Locator">URL</abbr> contienne une partie chemin.
       </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">
        Exige que l&#039;<abbr title="Uniform Resource Locator">URL</abbr> contienne une partie requête.
       </span>
      </dd>
     
    </dl>
    <div class="warning"><strong class="warning">Avertissement</strong>
     <p class="simpara">
      Une <abbr title="Uniform Resource Locator">URL</abbr> valide peut ne pas spécifier le
      protocole <abbr title="Hypertext Transfer Protocol">HTTP</abbr> (<code class="literal">http://</code>).
      Une validation supplémentaire peut donc être nécessaire pour vérifier si l&#039;<abbr title="Uniform Resource Locator">URL</abbr>
      utilise un protocole attendu, par exemple <code class="literal">ssh://</code> ou <code class="literal">mailto:</code>.
     </p>
    </div>
    <div class="warning"><strong class="warning">Avertissement</strong>
     <p class="simpara">
      Ce filtre ne fonctionne que sur les <abbr title="Uniform Resource Locator">URL</abbr>s <abbr title="American Standard Code for Information Interchange">ASCII</abbr>.
      Cela signifie que les noms de domaine internationalisés (IDN) seront toujours rejetés.
     </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">
     Valide si le nom de domaine est valide selon
     <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>,
     et
     <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">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner si le filtre échoue.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.domain.flags">
     <strong class="title">Options facultatives</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">
        Exige que les noms d&#039;hôte commencent par un caractère alphanumérique
        et ne contiennent que des caractères alphanumériques ou des traits d&#039;union.
       </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">
     Valide si la valeur est une adresse e-mail &quot;valide&quot;.
    </span>

    <span class="simpara">
     La validation est effectuée selon la syntaxe <code class="literal">addr-spec</code>
     dans le
     <a href="https://datatracker.ietf.org/doc/html/rfc822" class="link external">&raquo;&nbsp;RFC 822</a>.
     Cependant, les commentaires, le pliage des espaces blancs et les noms de domaine sans point
     ne sont pas pris en charge et seront donc rejetés.
    </span>

    <dl id="filter.constants.validation.email.options">
     <strong class="title">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner en cas d&#039;échec du filtre.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.email.flags">
     <strong class="title">Options facultatives</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">
        Accepte les caractères Unicode dans la partie locale.
        Disponible à partir de PHP 7.1.0.
       </span>
      </dd>
     
    </dl>

    <div class="warning"><strong class="warning">Avertissement</strong>
     <p class="simpara">
      La validation des e-mails est complexe et le seul moyen fiable de confirmer qu&#039;un e-mail
      est valide et existe est d&#039;envoyer un e-mail à l&#039;adresse.
     </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">
     Valide la valeur en tant qu&#039;adresse IP.
    </p>
    <dl id="filter.constants.validation.ip.options">
     <strong class="title">Options disponibles</strong>
     
      <dt><code class="literal">default</code></dt>
      <dd>
       <span class="simpara">
        Valeur à retourner en cas d&#039;échec du filtre.
       </span>
      </dd>
     
    </dl>
    <dl id="filter.constants.validation.ip.flags">
     <strong class="title">Options facultatives</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">
        Autoriser les adresses 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">
        Autoriser les adresses 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">
        Refuser les adresses réservées.
       </span>
       <span class="simpara">
        Ce sont les plages qui sont marquées comme
        <code class="literal">Reserved-By-Protocol</code> dans
        <a href="https://datatracker.ietf.org/doc/html/rfc6890" class="link external">&raquo;&nbsp;RFC 6890</a>.
       </span>
       <p class="para">
        Pour IPv4, cela correspond aux plages suivantes :
        <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">
         Et pour IPv6, cela correspond aux plages suivantes :
         <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">
          Refuser les adresses privées.
         </span>
         <p class="para">
          Ce sont des adresses IPv4 qui se trouvent dans les plages suivantes :
          <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">
           Ce sont des adresses IPv6 commençant par
           <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">
           N&#039;autoriser que les adresses globales.
           Celles-ci peuvent être trouvées dans
           <a href="https://datatracker.ietf.org/doc/html/rfc6890" class="link external">&raquo;&nbsp;RFC 6890</a>
           où l&#039;attribut <code class="literal">Global</code> est <code class="literal">True</code>.
           Disponible à partir de 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">
        Valide si la valeur est une adresse MAC.
       </span>

       <dl id="filter.constants.validation.mac.options">
        <strong class="title">Options disponibles</strong>
        
         <dt><code class="literal">default</code></dt>
         <dd>
          <span class="simpara">
           Valeur à retourner en cas d&#039;échec du filtre.
          </span>
         </dd>
        
       </dl>
      </dd>
     
    </dl>
    <dl id="filter.constants.sanitization">
     <strong class="title">Filtres de Sanitisation</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">
        Ce filtre ne fait rien.
       </span>
       <span class="simpara">
        Cependant, il peut supprimer ou encoder des caractères spéciaux s&#039;il est utilisé avec
        les indicateurs de filtrage de nettoyage
        <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
        et <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-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">
        Alias 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">
        Ce filtre supprime les balises et encode en HTML les guillemets doubles et simples.
       </span>
       <span class="simpara">
        Optionnellement, il peut supprimer ou encoder des caractères spécifiés s&#039;il est utilisé avec les
        filtres de sanitarisation <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
        et <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">
        Le comportement d&#039;encodage des guillemets peut être désactivé en utilisant le
        filtre <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">Avertissement</strong>
        <p class="simpara">
         <em>Obsolète</em> à partir de PHP 8.1.0,
         il convient d&#039;utiliser <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> à la place.
        </p>
       </div>
       <div class="warning"><strong class="warning">Avertissement</strong>
        <p class="simpara">
         La manière dont ce filtre supprime les balises n&#039;est pas équivalente à celle de
         <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">
        Alias 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">Avertissement</strong>
        <p class="simpara">
         <em>Obsolète</em> à partir de PHP 8.1.0,
         il convient d&#039;utiliser <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span> à la place.
        </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">
        Ce filtre effectue un encodage URL d&#039;une chaîne.
       </span>
       <span class="simpara">
        Il peut éventuellement supprimer ou encoder des caractères spécifiés s&#039;il est utilisé avec les
        filtres de sanitation <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>
        et <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">
        Ce filtre effectue un encodage HTML sur
        <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>
        et sur les caractères ayant une valeur ASCII inférieure à 32.
        Contrairement au filtre <strong><code><a href="filter.constants.php#constant.filter-sanitize-full-special-chars">FILTER_SANITIZE_FULL_SPECIAL_CHARS</a></code></strong>,
        le filtre <strong><code><a href="filter.constants.php#constant.filter-sanitize-special-chars">FILTER_SANITIZE_SPECIAL_CHARS</a></code></strong> ignore l’indicateur
        <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">
        En option, il peut supprimer des caractères spécifiés s&#039;il est utilisé avec les
        filtres de sanitation <strong><code><a href="filter.constants.php#constant.filter-flag-strip-low">FILTER_FLAG_STRIP_<span class="replaceable">*</span></a></code></strong>,
        et il peut encoder les caractères dont la valeur ASCII est supérieure à 127 en utilisant
        <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">
        Ce filtre équivaut à appeler <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>
        avec <strong><code><a href="string.constants.php#constant.ent-quotes">ENT_QUOTES</a></code></strong> activé.
       </span>
       <span class="simpara">
        Le comportement d&#039;encodage des guillemets peut être désactivé en utilisant le
        filtre <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">Avertissement</strong>
        <p class="simpara">
         Comme <span class="function"><a href="function.htmlspecialchars.php" class="function">htmlspecialchars()</a></span>, ce filtre tient compte du
         paramètre <a href="ini.core.php#ini.default-charset" class="link">default_charset</a> dans le fichier INI.
         Si une séquence d&#039;octets qui forme un caractère invalide dans le jeu de caractères actuel est détectée,
         toute la chaîne est rejetée, ce qui entraîne le retour d&#039;une chaîne vide.
        </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">
        Assainit la chaîne en supprimant tous les caractères sauf
        les lettres latines (<code class="literal">[a-zA-Z]</code>),
        les chiffres (<code class="literal">[0-9]</code>),
        et les caractères spéciaux
        <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">
        Assainit la chaîne en supprimant tous les caractères sauf
        les lettres latines (<code class="literal">[a-zA-Z]</code>),
        les chiffres (<code class="literal">[0-9]</code>),
        et les caractères spéciaux
        <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">
        Assainit la chaîne en supprimant tous les caractères sauf les chiffres
        (<code class="literal">[0-9]</code>), le signe plus (<code class="literal">+</code>),
        et le signe moins (<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">
        Assainir la chaîne en supprimant tous les caractères sauf les chiffres
        (<code class="literal">[0-9]</code>), le signe plus (<code class="literal">+</code>)
        et le signe moins (<code class="literal">-</code>).
       </span>

       <dl id="filter.constants.sanitization.float.flags">
        <strong class="title">Options Facultatives</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">
           Accepter le caractère point (<code class="literal">.</code>),
           qui représente habituellement le séparateur entre les parties
           entière et fractionnaire.
          </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">
           Accepter le caractère virgule (<code class="literal">,</code>),
           qui représente habituellement le séparateur de milliers.
          </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">
           Accepter les nombres en notation scientifique en autorisant
           les caractères <code class="literal">e</code> et <code class="literal">E</code>.
          </span>
         </dd>
        
       </dl>
       <div class="warning"><strong class="warning">Avertissement</strong>
        <p class="simpara">
         Si le filtre <strong><code><a href="filter.constants.php#constant.filter-flag-allow-fraction">FILTER_FLAG_ALLOW_FRACTION</a></code></strong> n&#039;est pas utilisé,
         le séparateur décimal est supprimé, modifiant ainsi la valeur reçue.
        </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">L&#039;exemple ci-dessus va afficher :</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">
        Appliquer <span class="function"><a href="function.addslashes.php" class="function">addslashes()</a></span> à l&#039;entrée.
        Disponible à partir de 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">
        Alias 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">Avertissement</strong>
        <p class="simpara">
         <em>OBSOLÈTE</em> à partir de PHP 7.3.0 et
         <em>SUPPRIMÉ</em> à partir de PHP 8.0.0.
        </p>
       </div>
      </dd>
     
    </dl>

    <dl>
     <strong class="title">Filtre Défini par l&#039;Utilisateur</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">
        Ce filtre délègue le filtrage à une fonction définie par l&#039;utilisateur.
        Le <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> est passé via le paramètre
        <code class="parameter">options</code> en tant que valeur associée à la clé
        <code class="literal">&#039;options&#039;</code>.
       </span>
       <p class="para">
        La fonction de rappel doit avoir la signature suivante :
        <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">
            La valeur qui est en cours de filtrage.
           </span>
          </dd>
         
        </dl>
       </p>
       <blockquote class="note"><p><strong class="note">Note</strong>: 
        <span class="simpara">
         La valeur retournée par le callback sera la valeur retournée par la
         fonction de filtre invoquée.
        </span>
       </p></blockquote>
       <div class="example" id="example-1">
        <p><strong>Exemple #1 
         Exemple d&#039;utilisation de <strong><code><a href="filter.constants.php#constant.filter-callback">FILTER_CALLBACK</a></code></strong> pour valider
         un nom de connexion
        </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">"val1dL0gin"</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">"f&amp;ke login"</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>L&#039;exemple ci-dessus va afficher :</p></div>
        <div class="example-contents screen">
<div class="cdata"><pre>
string(10) &quot;val1dL0gin&quot;
NULL
</pre></div>
        </div>
       </div>
       <div class="warning"><strong class="warning">Avertissement</strong>
        <p class="simpara">
         Ce filtre ne peut pas être utilisé avec d&#039;autres indicateurs de filtre,
         par exemple <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); ?>