News Feed
Sections




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

DevShed:
Validating Incoming Data by Using Polymorphism with Objects in PHP 5
April 05, 2007 @ 10:56:00

DevShed has posted the final part of their look at using polymorphism with objects in PHP5, this time with a focus on validating incoming data from a form.

In this final installment of the series I'm going to show you how to develop an expandable PHP mechanism for validating different types of incoming data. This will demonstrate how this important pillar of object-oriented programming can be used with a plethora of applications.

They show how to create a simple DataValidator class to act as a base to build from. On top of this, they create classes to validate if the value is:

  • empty
  • an integer
  • if it's numeric
  • if it's in a certain range
  • if it's alphanumeric
  • if it's alphabetic
  • or if it's a valid email address
They also include how to implement these filters, showing a simple Factory pattern that creates the object and runs the value through its validation.

0 comments voice your opinion now!
validation incoming data form polymorphism object php5 validation incoming data form polymorphism object php5


blog comments powered by Disqus

Similar Posts

Fabien Potencier's Blog: Do you need a Dependency Injection Container?

Nick Silvestro's Blog: Verification is a Wonderful Thing

Davey Shafik's Blog: ZCEGuide.com Deadline Fast Approaching

Mathias Verraes: When to Use Static Methods

DevShed: Adding Validation to an Image Generator Class with PHP 5


Community Events





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


tips podcast list language community bugfix deployment zendserver introduction code development interview framework api release symfony voicesoftheelephpant series threedevsandamaybe laravel

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