News Feed
Jobs Feed
Sections




News Archive
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

PHPRefresh.com: Managing Sessions and State with PHP

PHPBuilder.com: Create a Unit Conversion Application w/the Zend_Measure Component

Segment.io: How to Make Async Requests in PHP

AnyExample.com: PHP AJAX example: asynchronous file upload

NetTuts.com: Rapid Application Prototyping in PHP Using a Micro Framework


Community Events











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


phpunit unittest object interview language development opinion series podcast framework zendframework2 tool code release example introduction conference testing community functional

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