HomePHP Validating Incoming Data by Using Polymorphism with Objects in PHP 5
Validating Incoming Data by Using Polymorphism with Objects in PHP 5
If you're a PHP developer who wants to learn how to take advantage of polymorphism to build more efficient and robust object-oriented applications, then this group of articles might be what you need. Welcome to the final part of the series that started with "Using Polymorphism with Objects in PHP 5." Comprised of three tutorials, this series shows you how to create polymorphic classes with PHP; it also teaches you how to use them in real-world situations.
Having already introduced the subject of this series of articles, let me step back quickly to the second tutorial to refresh your memory of the topics it covered. As you'll certainly recall, I demonstrated how one of the main pillars of object-oriented programming, that is polymorphism, can be used to generate dynamic web pages with minor hassles.
As you learned in that article, building basic web documents by using the functionality provided by a few polymorphic classes can be very useful, since this approach allows you to declare, for instance, one method that is shared by different sub classes, and define programmatically what kind of operations should be performed by the method in question.
In essence, the previous schema illustrates in a nutshell how polymorphism works, since this model demonstrates how different objects that belong to the same family can behave differently using an identical method. Of course, this capacity was applied to building dynamic web pages, but it can also be used in other cases, such as developing database abstraction classes, generating online forms, and so forth.
Speaking of the numerous situations where Polymorphism can be implemented successfully to build more efficient object-based programs, 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.
So are you ready to learn how to use polymorphism for checking user-provided data? Okay, let's get started!