PHP
  Home arrow PHP arrow Implementing Destructors with Multiple...
Dev Shed Forums 
Administration  
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 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 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

Implementing Destructors with Multiple Objects in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2008-01-23

    Table of Contents:
  • Implementing Destructors with Multiple Objects in PHP 5
  • Handling user-related data with a simple PHP 5 class
  • Working with multiple objects by redefining the destructor of the previous “User” class
  • Finding out the order in which several destructors are called by the PHP interpreter

  • 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

    Route your faxes to your email inbox. Private, secure fax numbers available from CallWave. Choose your fax number.

    Implementing Destructors with Multiple Objects in PHP 5
    (Page 1 of 4 )

    Welcome to the second installment of the series “Understanding Destructors in PHP 5.” Whether you’re a PHP programmer who’s making their first steps in the area of professional PHP development, or an experienced developer with a solid background in object-based PHP programming, this article series can provide you with an approachable guide for using destructors in PHP 5-controlled development environments.

    If you’re starting to get familiar with the numerous features incorporated into the improved object model of PHP 5, then you may have already heard about class destructors. But what are they? Simply put, a destructor is a method defined by a given class that will be automatically called by the PHP interpreter before destroying any instance of that particular class.

    Indeed, they can be quite useful for tracking the status of objects during the execution of different scripts. Therefore, if you’re interested in learning how to work with destructors within your own PHP 5 classes, then this group of articles might be what you’re looking for.

    Now that I've introduced you to the main subject of this series, I’d like to spend a few moments rehashing the items we discussed in the last article regarding the basic utilization of destructors with PHP 5. As you’ll probably recall, during that particular tutorial I walked you through both the theoretical and practical concepts concerning the definition and implementation of a simple destructor method within a sample class.

    In that specific case, I utilized a trivial “User” object to show how its corresponding destructor was called right before destroying the object in question. In this way I illustrated how the functionality of destructors can be exploited using a basic approach.

    Naturally, destructors can be used in all sorts of clever ways in the context of a given PHP 5 application, mostly in those cases where it’s necessary to keep track of the status of certain objects prior to their being destroyed by the PHP interpreter. Nevertheless, this is undoubtedly a more complex topic that will be discussed in detail in upcoming articles of the series. So for the moment, I’m going to continue at my own pace, and consequently, in this second chapter you’ll learn how to work simultaneously with multiple classes that concretely implement their respective destructors.

    The subject is indeed very interesting, so I think it's time to move forward and keep learning more useful things concerning the usage of destructors with PHP 5. Let’s go!

    More PHP Articles
    More By Alejandro Gervasio


       · In the first episode of the series, I introduced you to using destructors in PHP 5,...
     

       

    PHP ARTICLES

    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery
    - Using Timers to Benchmark PHP Applications
    - Benchmarking Applications with PHP
    - Setting Up a Web-Based File Manager: PHPfile...
    - Developing a Modular Class For a PHP File Up...
    - Setting Up a Web-Based File Manager: bfExplo...
    - Defining a Custom Function for File Uploader...
    - Parsing Child Nodes with the DOM XML extensi...
    - Creating an Error Handling Module for a PHP ...
    - Accessing Attributes and Cloning Nodes with ...
    - Retrieving Information on Selected Files wit...
    - Handling HTML Strings and Files with the DOM...
    - Building File Uploaders with PHP 5

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway