DevShed has a new article posted today that can help anyone out there, even those not all that familiar with object-oriented programming in PHP, to create a Form Generator with inheritance and polymorphism.
If you ever tasted the power of Object Oriented Programming (OOP) in PHP, then you probably know that it's an extremely useful way to manage medium and large projects, where code reusability, extendibility and maintainability are key factors that make developing Web applications a relatively painless experience.
[...] It's time to focus our attention on two primary bases of OOP: Inheritance and Polymorphism. In the rest of this article, we'll introduce these concepts as they are applied in PHP, with a rather practical approach, in order to find their place in a real application: building an extensible form generator.
It's not the best method to perform the task that I've ever seen, but it does stand up as a good example of how inheritance works with PHP classes. Personally, I'd rather go with something more like HTML_QuickForm. All of the overhead they create seems a bit silly just to make an HTML form...




