<!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>Filter flags</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="filter.filters.misc.html">Other filters</a></div> <div class="next" style="text-align: right; float: right;"><a href="filter.constants.html">Predefined Constants</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.flags" class="section"> <h2 class="title">Filter flags</h2> <p class="para"> <table class="doctable table"> <caption><strong>List of filter flags</strong></caption> <thead> <tr> <th>ID</th> <th>Used with</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td><strong><code>FILTER_FLAG_STRIP_LOW</code></strong></td> <td> <strong><code>FILTER_SANITIZE_ENCODED</code></strong>, <strong><code>FILTER_SANITIZE_SPECIAL_CHARS</code></strong>, <strong><code>FILTER_SANITIZE_STRING</code></strong>, <strong><code>FILTER_UNSAFE_RAW</code></strong> </td> <td> Strips characters that has a numerical value <32. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_STRIP_HIGH</code></strong></td> <td> <strong><code>FILTER_SANITIZE_ENCODED</code></strong>, <strong><code>FILTER_SANITIZE_SPECIAL_CHARS</code></strong>, <strong><code>FILTER_SANITIZE_STRING</code></strong>, <strong><code>FILTER_UNSAFE_RAW</code></strong> </td> <td> Strips characters that has a numerical value >127. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ALLOW_FRACTION</code></strong></td> <td> <strong><code>FILTER_SANITIZE_NUMBER_FLOAT</code></strong> </td> <td> Allows a period (<em>.</em>) as a fractional separator in numbers. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ALLOW_THOUSAND</code></strong></td> <td> <strong><code>FILTER_SANITIZE_NUMBER_FLOAT</code></strong>, <strong><code>FILTER_VALIDATE_FLOAT</code></strong> </td> <td> Allows a comma (<em>,</em>) as a thousands separator in numbers. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ALLOW_SCIENTIFIC</code></strong></td> <td> <strong><code>FILTER_SANITIZE_NUMBER_FLOAT</code></strong> </td> <td> Allows an <em>e</em> or <em>E</em> for scientific notation in numbers. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_NO_ENCODE_QUOTES</code></strong></td> <td> <strong><code>FILTER_SANITIZE_STRING</code></strong> </td> <td> If this flag is present, single (<em>'</em>) and double (<em>"</em>) quotes will not be encoded. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ENCODE_LOW</code></strong></td> <td> <strong><code>FILTER_SANITIZE_ENCODED</code></strong>, <strong><code>FILTER_SANITIZE_STRING</code></strong>, <strong><code>FILTER_SANITIZE_RAW</code></strong> </td> <td> Encodes all characters with a numerical value <32. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ENCODE_HIGH</code></strong></td> <td> <strong><code>FILTER_SANITIZE_ENCODED</code></strong>, <strong><code>FILTER_SANITIZE_SPECIAL_CHARS</code></strong>, <strong><code>FILTER_SANITIZE_STRING</code></strong>, <strong><code>FILTER_SANITIZE_RAW</code></strong> </td> <td> Encodes all characters with a numerical value >127. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ENCODE_AMP</code></strong></td> <td> <strong><code>FILTER_SANITIZE_STRING</code></strong>, <strong><code>FILTER_SANITIZE_RAW</code></strong> </td> <td> Encodes ampersands (<em>&</em>). </td> </tr> <tr> <td><strong><code>FILTER_NULL_ON_FAILURE</code></strong></td> <td> <strong><code>FILTER_VALIDATE_BOOLEAN</code></strong> </td> <td> Returns <strong><code>NULL</code></strong> for unrecognized boolean values. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ALLOW_OCTAL</code></strong></td> <td> <strong><code>FILTER_VALIDATE_INT</code></strong> </td> <td> Regards inputs starting with a zero (<em>0</em>) as octal numbers. This only allows the succeeding digits to be <em>0-7</em>. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_ALLOW_HEX</code></strong></td> <td> <strong><code>FILTER_VALIDATE_INT</code></strong> </td> <td> Regards inputs starting with <em>0x</em> or <em>0X</em> as hexadecimal numbers. This only allows succeeding characters to be <em>a-fA-F0-9</em>. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_IPV4</code></strong></td> <td> <strong><code>FILTER_VALIDATE_IP</code></strong> </td> <td> Allows the IP address to be in IPv4 format. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_IPV6</code></strong></td> <td> <strong><code>FILTER_VALIDATE_IP</code></strong> </td> <td> Allows the IP address to be in IPv6 format. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_NO_PRIV_RANGE</code></strong></td> <td> <strong><code>FILTER_VALIDATE_IP</code></strong> </td> <td> <p class="para"> Fails validation for the following private IPv4 ranges: <em>10.0.0.0/8</em>, <em>172.16.0.0/12</em> and <em>192.168.0.0/16</em>. </p> <p class="para"> Fails validation for the IPv6 addresses starting with <em>FD</em> or <em>FC</em>. </p> </td> </tr> <tr> <td><strong><code>FILTER_FLAG_NO_RES_RANGE</code></strong></td> <td> <strong><code>FILTER_VALIDATE_IP</code></strong> </td> <td> Fails validation for the following reserved IPv4 ranges: <em>0.0.0.0/8</em>, <em>169.254.0.0/16</em>, <em>192.0.2.0/24</em> and <em>224.0.0.0/4</em>. This flag does not apply to IPv6 addresses. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_PATH_REQUIRED</code></strong></td> <td> <strong><code>FILTER_VALIDATE_URL</code></strong> </td> <td> Requires the <acronym title="Uniform Resource Locator">URL</acronym> to contain a path part. </td> </tr> <tr> <td><strong><code>FILTER_FLAG_QUERY_REQUIRED</code></strong></td> <td> <strong><code>FILTER_VALIDATE_URL</code></strong> </td> <td> Requires the <acronym title="Uniform Resource Locator">URL</acronym> to contain a query string. </td> </tr> </tbody> </table> </p> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="filter.filters.misc.html">Other filters</a></div> <div class="next" style="text-align: right; float: right;"><a href="filter.constants.html">Predefined Constants</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>