News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Input Validation Using Filter Functions
June 01, 2012 @ 15:53:28

On PHPMaster.com today there's a good tutorial that gives you some methods to do one of the most important things in any application - validating input. Their examples show how to use some of PHP's own filter functions to accomplish this.

Filter functions in PHP might not be sexy, but they can improve the stability, security, and even maintainability of your code if you learn how to use them correctly. In this article I'll explain why input validation is important, why using PHPs built-in functions for performing input validation is important, and then throw together some examples (namely using filter_input() and filter_var()), discuss some potential pitfalls, and finish with a nice, juicy call to action.

He talks about why validation is important to protect your application (and users) from malicious things like cross-site scripting. He emphasizes the use of PHP's own filter methods because they are established and, well, included in the language - no additional libraries needed. Example code is included showing how to use them to filter email addresses and check that something is an integer.

You can find out more about these functions on their manual pages: filter_input, filter_var.

0 comments voice your opinion now!
input validation filter tutorial bestpractice filtervar filterinput


blog comments powered by Disqus

Similar Posts

SitePoint PHP Blog: Find and Correct Misspelled Words with Pspell

Query7.com: Developing A Blog With CakePHP

Till Klampaeckel's Blog: So you'd like to migrate from MySQL to CouchDB? - Part II

Manuel Pichler's Blog: PHP_Depend jumps on the D-BUS

Gonzalo Ayuso: Sending automated emails with PHP, Swiftmailer and Twig


Community Events

Don't see your event here?
Let us know!


example api extension series release podcast php7 introduction library symfony2 opinion version framework performance xdebug voicesoftheelephpant community interview laravel conference

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework