R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

PHP Programing language

Previous Home Next

Filters in Php

PHP filters are used to validating data means determine if the data is in proper form and sanitizing data means remove any illegal character from the data external input.

The PHP filter extension has many of the functions needed for checking user input, and is designed to make data validation easier and quicker.

Use of Filters

There are many web applications receive external input that is :

  • User input from a form
  • Cookies
  • Web services data
  • Server variables
  • Database query results


table, th, td 
border: 1px solid black;
border-collapse: collapse;
th, td 
padding: 8px;
<td>Filter Name</td>
<td>Filter ID</td>

foreach (filter_list() as $id =>$filter) 
echo '<tr><td>' . $filter . '</td><td>' . filter_id($filter) . '</td></tr>';



Some Filter Functions are:
Function Name Description
filter_has_var() Checks if a variable of a specified input type exist
filter_id() Returns the filter ID of a specified filter name
filter_input() Gets an external variable (e.g. from form input) and optionally filters it.
filter_input_array() Gets external variables (e.g. from form input) and optionally filters them
filter_list() Returns a list of all supported filters
filter_var_array() Gets multiple variables and filter them
filter_var() Filters a variable with a specified filter
Previous Home Next