PHP
  Home arrow PHP arrow PHP 5 and Polymorphism
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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? 
PHP

PHP 5 and Polymorphism
By: David Fells
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 23
    2006-03-06

    Table of Contents:
  • PHP 5 and Polymorphism
  • What is Polymorphism?
  • Applying Polymorphic Design
  • Late Binding in PHP 5, or, the Lack Thereof

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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


    PHP 5 and Polymorphism


    (Page 1 of 4 )

    This article explains what polymorphism is and how it applies to object oriented design in particular. It also explains the pros and cons of polymorphism when working with certain versions of PHP.

    NOTE: The latest versions of PHP, and I am not sure in which exact version this was corrected, support late binding properly. There are still tons of issues with using late binding in cahoots with a bytecode cache, for reasons beyond my understanding or concern. Those of you using an older version of PHP (I still have 5.0.1 on a server) can see for yourselves the lack of late binding support. I initially rescinded this article after learning that late binding is properly supported in current versions, but it is important that you be aware of the possibility that it may not work in your particular PHP 5 install.

    PHP 5 and Polymorphism

    This article is going to cover one of the most important parts of object oriented programming and design–polymorphism–using PHP 5 for demonstration purposes. Before you continue, be warned that this article is not entirely positive in regard to PHP. While the language is great for rapid development and has made tremendous strides in the last two major versions, its object support still has a way to go before being on par with more mature languages like C++ or Java.

    If you are an object programming guru this article probably isn’t for you, since polymorphism is one of those things you learn light-switch style – suddenly it’s all clear, and once you understand it, you never forget. If you are looking to learn a bit about object programming and design and you aren’t really sure exactly what it means when someone says an object is polymorphic, this article will help.

    By the end of this article, you should know what polymorphism is and how it applies to object oriented design in particular, and you should know about the pros and cons of PHP 5 object programming as it pertains to polymorphism.

    More PHP Articles
    More By David Fells


       · class Factory{ static function getFils($name){ return new $name(); ...
       · Thanks for reading! As noted at the start of the article, late binding did start...
       · Hello,PHP 4 supported also late binding. Try following...
       · HiI think you could solve all the problems just by using a abstract class. With...
       · HiI haven't read the existing comments exact enoung, my solution is posted...
       · Hi thereI think some fundamental things should be cleared up here. First of all,...
       · Creating a abstract class ,overidding a func..using the base class func with the...
       · I cant believe this article is still online and google is giving it hits, i would...
     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT