<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Generated by xml_proto.php v2.4. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.filter-input" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>filter_input</refname>
  <refpurpose>Gets a specific external variable by name and optionally filters it</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>mixed</type><methodname>filter_input</methodname>
   <methodparam><type>int</type><parameter>type</parameter></methodparam>
   <methodparam><type>string</type><parameter>var_name</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>filter</parameter><initializer><constant>FILTER_DEFAULT</constant></initializer></methodparam>
   <methodparam choice="opt"><type class="union"><type>array</type><type>int</type></type><parameter>options</parameter><initializer>0</initializer></methodparam>
  </methodsynopsis>

 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>type</parameter></term>
     <listitem>
      <para>
       One of <constant>INPUT_GET</constant>, <constant>INPUT_POST</constant>,
       <constant>INPUT_COOKIE</constant>, <constant>INPUT_SERVER</constant>, or
       <constant>INPUT_ENV</constant>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>var_name</parameter></term>
     <listitem>
      <para>
       Name of a variable to get.
      </para>
     </listitem>
    </varlistentry>
    &filter.param.filter;
    <varlistentry>
     <term><parameter>options</parameter></term>
     <listitem>
      <para>
       Associative array of options or bitwise disjunction of flags. If filter
       accepts options, flags can be provided in "flags" field of array.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Value of the requested variable on success, &false; if the filter fails,
   or &null; if the <parameter>var_name</parameter> variable is not set.
   If the flag <constant>FILTER_NULL_ON_FAILURE</constant> is used, it
   returns &false; if the variable is not set and &null; if the filter fails.
   </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>A <function>filter_input</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$search_html = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_SPECIAL_CHARS);
$search_url = filter_input(INPUT_GET, 'search', FILTER_SANITIZE_ENCODED);
echo "You have searched for $search_html.\n";
echo "<a href='?search=$search_url'>Search again.</a>";
?>
]]>
    </programlisting>
    &example.outputs.similar;
    <screen>
<![CDATA[
You have searched for Me &#38; son.
<a href='?search=Me%20%26%20son'>Search again.</a>
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>filter_var</function></member>
    <member><function>filter_input_array</function></member>
    <member><function>filter_var_array</function></member>
    <member><xref linkend="filter.filters"/></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
