PHP
  Home arrow PHP arrow Working with Strings and the Composite Pattern 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? 
PHP

Working with Strings and the Composite Pattern in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 3
    2007-03-14


    Table of Contents:
  • Working with Strings and the Composite Pattern in PHP 5
  • Handling strings of data
  • Defining the SingleStringProcessor and MultipleStringProcessor classes
  • Putting all the classes to work together

  • 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


    Working with Strings and the Composite Pattern in PHP 5
    ( Page 1 of 4 )

    Are you a PHP developer who wants to improve your skills in pattern-based programming in PHP? If the answer to this question is an emphatic yes, then you should begin reading this article now! Welcome to the final part of the series “Implementing the composite pattern with PHP 5.” Comprised of two instructive tutorials, this series walks you through the basic concepts of this important design pattern, and shows you how to apply it with some educational examples.

    Introduction

    Before I move forward and tell you about the topics that I plan to cover in this final installment of the series, first I’d like to revisit briefly the concepts deployed in the preceding article. This will give you a better idea of how both tutorials are linked to each other.

    As you’ll certainly remember, in the first part of the series I introduced the foundations of the composite pattern, and also explained in detail how it could be applied. To quickly review its theoretical definition, in the composite pattern, one object or a set of objects will behave similarly across an application, regardless of the context where they will be used.

    Of course, bearing in mind that the previous definition is in fact quite confusing, I demonstrated the application of the pattern in question by setting up a testing example. The example showed how two different file reading classes were able to generate nearly identical outputs, regardless of whether they used one or multiple file handling objects.   

    However, I believe that the example that I mentioned previously isn’t good enough to give a reader a decent background on how this pattern works. Thus, since this series is aimed at mastering the basic concepts of the composite pattern, in this final article I’m going to demonstrate how to use it to handle strings of data.

    By the end of this article, you should have a more solid foundation on how to apply the pattern in question as part of your own PHP applications.

    With the preliminaries out of the way, let’s continue learning more about the composite pattern. Let’s get going!



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

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





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