Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 1950

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Validate filters</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="filter.filters.html">Types of filters</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="filter.filters.sanitize.html">Sanitize filters</a></div>
 <div class="up"><a href="filter.filters.html">Types of filters</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="filter.filters.validate" class="section">
  <h2 class="title">Validate filters</h2>
   <p class="para">
    <table class="doctable table">
     <caption><strong>Listing of filters for validation</strong></caption>
     
      <thead>
       <tr>
        <th>ID</th>
        <th>Name</th>
        <th>Options</th>
        <th>Flags</th>
        <th>Description</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td><strong><code>FILTER_VALIDATE_BOOLEAN</code></strong></td>
        <td>&quot;boolean&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>
        </td>
        <td>
          <strong><code>FILTER_NULL_ON_FAILURE</code></strong>
        </td>
        <td>
         <p class="para">
          Returns <strong><code>TRUE</code></strong> for &quot;1&quot;, &quot;true&quot;, &quot;on&quot; and &quot;yes&quot;.
          Returns <strong><code>FALSE</code></strong> otherwise.
         </p>
         <p class="para">
          If <strong><code>FILTER_NULL_ON_FAILURE</code></strong> is set, <strong><code>FALSE</code></strong> is
          returned only for &quot;0&quot;, &quot;false&quot;, &quot;off&quot;, &quot;no&quot;, and &quot;&quot;, and
          <strong><code>NULL</code></strong> is returned for all non-boolean values.
         </p>
        </td>
       </tr>

       <tr>
        <td><strong><code>FILTER_VALIDATE_EMAIL</code></strong></td>
        <td>&quot;validate_email&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>
        </td>
        <td class="empty">&nbsp;</td>
        <td>Validates value as e-mail.</td>
       </tr>

       <tr>
        <td><strong><code>FILTER_VALIDATE_FLOAT</code></strong></td>
        <td>&quot;float&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>,
         <em><code class="parameter">decimal</code></em>
        </td>
        <td>
         <strong><code>FILTER_FLAG_ALLOW_THOUSAND</code></strong>
        </td>
        <td>Validates value as float.</td>
       </tr>

       <tr>
        <td><strong><code>FILTER_VALIDATE_INT</code></strong></td>
        <td>&quot;int&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>,
         <em><code class="parameter">min_range</code></em>,
         <em><code class="parameter">max_range</code></em>
        </td>
        <td>
         <strong><code>FILTER_FLAG_ALLOW_OCTAL</code></strong>,
         <strong><code>FILTER_FLAG_ALLOW_HEX</code></strong>
        </td>
        <td>Validates value as integer, optionally from the specified range.</td>
       </tr>

       <tr>
        <td><strong><code>FILTER_VALIDATE_IP</code></strong></td>
        <td>&quot;validate_ip&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>
        </td>
        <td>
         <strong><code>FILTER_FLAG_IPV4</code></strong>,
         <strong><code>FILTER_FLAG_IPV6</code></strong>,
         <strong><code>FILTER_FLAG_NO_PRIV_RANGE</code></strong>,
         <strong><code>FILTER_FLAG_NO_RES_RANGE</code></strong>
        </td>
        <td>
         Validates value as IP address, optionally only IPv4 or IPv6 or not
         from private or reserved ranges.
        </td>
       </tr>

       <tr>
        <td><strong><code>FILTER_VALIDATE_REGEXP</code></strong></td>
        <td>&quot;validate_regexp&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>,
         <em><code class="parameter">regexp</code></em>
        </td>
        <td class="empty">&nbsp;</td>
        <td>
         Validates value against <em><code class="parameter">regexp</code></em>, a
         <a href="book.pcre.html" class="link">Perl-compatible</a> regular expression.
        </td>
       </tr>

       <tr>
        <td><strong><code>FILTER_VALIDATE_URL</code></strong></td>
        <td>&quot;validate_url&quot;</td>
        <td>
         <em><code class="parameter">default</code></em>
        </td>
        <td>
         <strong><code>FILTER_FLAG_PATH_REQUIRED</code></strong>,
         <strong><code>FILTER_FLAG_QUERY_REQUIRED</code></strong>
        </td>
        <td>Validates value as URL (according to <a href="http://www.faqs.org/rfcs/rfc2396" class="link external">&raquo;&nbsp;http://www.faqs.org/rfcs/rfc2396</a>), optionally with required components. Beware a valid URL may not specify the HTTP protocol <em><code class="parameter">http://</code></em> so further validation may be required to determine the URL uses an expected protocol, e.g. <em><code class="parameter">ssh://</code></em> or <em><code class="parameter">mailto:</code></em>. Note that the function will only find ASCII URLs to be valid; internationalized domain names (containing non-ASCII characters) will fail.</td>
       </tr>

      </tbody>
     
    </table>

   </p>
   <blockquote class="note"><p><strong class="note">Note</strong>: 
    <p class="para">
     As of PHP 5.4.11, the numbers +0 and -0 validate as both integers as well
     as floats (using <strong><code>FILTER_VALIDATE_FLOAT</code></strong> and
     <strong><code>FILTER_VALIDATE_INT</code></strong>). Before PHP 5.4.11 they only
     validated as floats (using <strong><code>FILTER_VALIDATE_FLOAT</code></strong>).
    </p>
    <p class="para">
     When <em><code class="parameter">default</code></em> is set to option, <em><code class="parameter">default</code></em>&#039;s value is used if value is not validated.
    </p>
   </p></blockquote>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="filter.filters.html">Types of filters</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="filter.filters.sanitize.html">Sanitize filters</a></div>
 <div class="up"><a href="filter.filters.html">Types of filters</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>