<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.filter.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.filter-input.php',
    1 => 'filter_input',
    2 => 'Nimmt eine Variable von Au&szlig;en entgegen und filtert sie optional',
  ),
  'up' => 
  array (
    0 => 'ref.filter.php',
    1 => 'Filter-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.filter-id.php',
    1 => 'filter_id',
  ),
  'next' => 
  array (
    0 => 'function.filter-input-array.php',
    1 => 'filter_input_array',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/filter/functions/filter-input.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.filter-input" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">filter_input</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">filter_input</span> &mdash; <span class="dc-title">Nimmt eine Variable von Außen entgegen und filtert sie optional</span></p>

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

 </div>


 <div class="refsect1 parameters" id="refsect1-function.filter-input-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">type</code></dt>
    <dd>
     <span class="simpara">
      Eine der <strong><code><a href="filter.constants.php#constant.input-post">INPUT_<span class="replaceable">*</span></a></code></strong>-Konstanten.
     </span>
     <div class="warning"><strong class="warning">Warnung</strong>
      <p class="simpara">
       Der Inhalt der zu filternden Superglobalen ist der ursprüngliche &quot;rohe&quot;
       Inhalt, der von der <abbr title="Server Application Programming Interface">SAPI</abbr> bereitgestellt wird, d. h.
       bevor die Superglobale verändert wurde.
       Um eine geänderte Superglobale zu filtern, sollte stattdessen
       <span class="function"><a href="function.filter-var.php" class="function">filter_var()</a></span> verwendet werden.
      </p>
     </div>
    </dd>
   
   
    <dt><code class="parameter">var_name</code></dt>
    <dd>
     <span class="simpara">
      Der Name einer Variablen, die innerhalb der Superglobalen des
      betreffenden <code class="parameter">type</code> gefiltert werden soll.
     </span>
    </dd>
   
   
    <dt><code class="parameter">filter</code></dt>
    <dd>
     <span class="simpara">
      Der anzuwendende Filter.
      Dies kann entweder ein Validierungsfilter sein, indem eine der
      <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_<span class="replaceable">*</span></a></code></strong>-Konstanten
      verwendet wird, ein Bereinigungsfilter, indem eine der
      <strong><code><a href="filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_<span class="replaceable">*</span></a></code></strong>-Konstanten
      verwendet wird, der Fiter <strong><code><a href="filter.constants.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong> oder ein
      benutzerdefinierter Filter durch Verwendung von
      <strong><code><a href="filter.constants.php#constant.filter-callback">FILTER_CALLBACK</a></code></strong>.
     </span>
     <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
      <span class="simpara">
       Die Voreinstellung ist <strong><code><a href="filter.constants.php#constant.filter-default">FILTER_DEFAULT</a></code></strong>, was ein
       Alias von <strong><code><a href="filter.constants.php#constant.filter-unsafe-raw">FILTER_UNSAFE_RAW</a></code></strong> ist.
       Dies bedeutet, dass standardmäßig keine Filterung stattfindet.
      </span>
     </p></blockquote>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <span class="simpara">
      Entweder ein assoziatives <span class="type"><a href="language.types.array.php" class="type array">array</a></span> von Optionen oder eine
      Bitmaske der Filterflag-Konstanten
      <strong><code><a href="filter.constants.php#constant.filter-flag-none">FILTER_FLAG_<span class="replaceable">*</span></a></code></strong>.
     </span>
     <span class="simpara">
      Wenn <code class="parameter">filter</code> Optionen akzeptiert, können die Flags
      durch Verwendung des Array-Schlüssels <code class="literal">&quot;flags&quot;</code>
      angegeben werden.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.filter-input-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Bei Erfolg wird die gefilterte Variable zurückgegeben.
   Wenn die Variable nicht gesetzt ist, wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
   Im Fehlerfall wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben, es sei denn, das Flag
   <strong><code><a href="filter.constants.php#constant.filter-null-on-failure">FILTER_NULL_ON_FAILURE</a></code></strong> wird verwendet; in diesem Fall
   wird <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> zurückgegeben.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.filter-input-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="example-1">
   <p><strong>Beispiel #1 <span class="function"><strong>filter_input()</strong></span>-Beispiel</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$search_html </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_input</span><span style="color: #007700">(</span><span style="color: #0000BB">INPUT_GET</span><span style="color: #007700">, </span><span style="color: #DD0000">'search'</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_SANITIZE_SPECIAL_CHARS</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$search_url </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_input</span><span style="color: #007700">(</span><span style="color: #0000BB">INPUT_GET</span><span style="color: #007700">, </span><span style="color: #DD0000">'search'</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_SANITIZE_ENCODED</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Sie haben nach </span><span style="color: #0000BB">$search_html</span><span style="color: #DD0000"> gesucht.\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #DD0000">"&lt;a href='?search=</span><span style="color: #0000BB">$search_url</span><span style="color: #DD0000">'&gt;Erneut suchen.&lt;/a&gt;"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Sie haben nach Ich &amp;#38 Sohn gesucht.
&lt;a href=&#039;?search=Ich%20%26%20Sohn&#039;&gt;Erneut suchen.&lt;/a&gt;</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.filter-input-seealso">
  <h3 class="title">Siehe auch</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.filter-input-array.php" class="function" rel="rdfs-seeAlso">filter_input_array()</a> - Nimmt mehrere Variablen von Au&szlig;en entgegen und filtert sie optional</span></li>
   <li><span class="function"><a href="function.filter-var.php" class="function" rel="rdfs-seeAlso">filter_var()</a> - Filtert eine Variable mit einem angegebenen Filter</span></li>
   <li><span class="function"><a href="function.filter-var-array.php" class="function" rel="rdfs-seeAlso">filter_var_array()</a> - Nimmt mehrere Variablen entgegen und filtert sie optional</span></li>
   <li>
    Validierungsfilter
    <strong><code><a href="filter.constants.php#constant.filter-validate-bool">FILTER_VALIDATE_<span class="replaceable">*</span></a></code></strong>
   </li>
   <li>
    Bereinigungsfilter
    <strong><code><a href="filter.constants.php#constant.filter-sanitize-string">FILTER_SANITIZE_<span class="replaceable">*</span></a></code></strong>
   </li>
  </ul>
 </div>


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