Home arrow PHP arrow Building Dynamic Web Pages with Polymorphism in PHP 5

Building Dynamic Web Pages with Polymorphism in PHP 5

If you’re starting to delve deeper into object-oriented programming with PHP, and also want to know how to include polymorphic objects into your own scripts, this might be the right opportunity to learn more about this interesting topic. Welcome to the second part of the series that began with “Using polymorphism with objects in PHP 5.” In three articles, this series provides you with a comprehensive guide on how to take advantage of polymorphism to build more efficient object-based PHP applications.

  1. Building Dynamic Web Pages with Polymorphism in PHP 5
  2. Building web pages using Polymorphism
  3. Extending the concept of polymorphic classes
  4. Seeing some polymorphic objects in action
By: Alejandro Gervasio
Rating: starstarstarstarstar / 15
March 28, 2007

print this article




If you already read the first article of the series, then it's quite probable that the concept of working with polymorphic objects is now very familiar to you. However, in case this subject doesn't ring any bells, let me offer a brief introduction. This will give you a more solid background for tackling the group of topics that I plan to cover in this article.

In short, Polymorphism is a feature exposed by certain objects that belong to the same family, which eventually can behave differently, even when they're using identical methods. Or more clearly, an object can be considered polymorphic when it's capable of performing different actions by utilizing the same method.

As you can see, this feature can be really useful in certain situations where using polymorphic objects can improve noticeably the way that a specific application is structured, aside from avoiding the inclusion into the source code of redundant checking blocks, such as the popular "if" and "switch/case" combinations.

The previous theory was clearly demonstrated in the preceding article, where I showed how to take advantage of polymorphism by building a simple yet expansible database abstraction layer for working with MySQL and SQLite. Obviously, the aforementioned  layer used polymorphic objects for accessing both database systems, but this concept can be easily extended to other applications, which makes it even more interesting.

Therefore, bearing in mind that the implementation of polymorphic objects in PHP 5 can be indeed as useful to you as it is to me, in this second part of the series, I'm going to show you how to use polymorphism to build dynamic web pages.

The experience not only will be interesting, but also educational, so let's not waste more time in preliminaries. 

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: