PHP AdvancedLesson 38Free preview
PHP Filters
This lesson is part of PHP · All levels
Summary
PHP Filters provide standard ways to validate and clear input data, such as checking integers, e-mails, or URLs. Its main function is filter_var() combined with the constants FILTER_VALIDATE_* and FILTER_SANITIZE_*. Using built-in filters makes validation faster and more consistent.
Key points
- Apply a validation or sanitization filter to a single value
- Filter_VALIDATE_* checks the format, Filter_SANITIZE_* clears the data
- FILTER_SANITIZE_STRING deleted the HTML tag, but it is now deprecated
- Is a safe option for output sanitation
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.