PHP
  Home arrow PHP arrow Building Dynamic Web Pages with Polymorphism in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Building Dynamic Web Pages with Polymorphism in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 13
    2007-03-28


    Table of Contents:
  • Building Dynamic Web Pages with Polymorphism in PHP 5
  • Building web pages using Polymorphism
  • Extending the concept of polymorphic classes
  • Seeing some polymorphic objects in action

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Building Dynamic Web Pages with Polymorphism in PHP 5
    ( Page 1 of 4 )

    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.

    Introduction

    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
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek