PHP FILTERS
- PHP filters are used to validate and sanitize 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.
TYPES OF FILTERS IN PHP :
- Validate filters.
- Sanitize filters.
- Other filters.
- Filter flags.
IMPLEMENT FILTERS IN PHP :
- Create a Directory Structure.
- Create MySQL Table.
- Insert Data into MySQL Table.
- Setup MySQL Database Connection.
- Create a Form to Filter Data.
- Write Filtering data by Category Script in PHP.
- Display Filtered Data in Table.
- Test yourself to filter data by Category.
EXAMPLE FOR FILTERS IN PHP :
<?php
$str = "<h1>Hello Nanba!</h1>";
$newstr = filter_var($str, FILTER_SANITIZE_STRING);
echo $newstr;
?>
OUTPUT :
Hello Nanba!