PHP
  Home arrow PHP arrow Keeping Track of Objects when Using De...
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

Keeping Track of Objects when Using Destructors in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2008-01-30

    Table of Contents:
  • Keeping Track of Objects when Using Destructors in PHP 5
  • When the order really matters: working with multiple destructors
  • Retrieving useful information about a particular object before it's removed
  • Seeing the improved User class in action

  • 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

    Lose your application development headaches. Start developing and deploying applications with Advantage Database Server today. Download a 30-day trial for Free!

    Keeping Track of Objects when Using Destructors in PHP 5
    (Page 1 of 4 )

    Among the improvements that were introduced into the object model of PHP 5, class destructors are quite possibly, one of the easiest to learn and implement. As you may have heard, a destructor is a special kind of method that is called automatically by the PHP interpreter right before destroying a particular object. So if you’re interested in learning how to use them in your own PHP 5-driven applications, you should start reading this article series!

    This is the third chapter of the series "Understanding destructors in PHP 5." In the different tutorials that comprise the series, you'll find the right pointers to start utilizing destructors within your PHP 5 classes. And in addition to learning the corresponding theory regarding these useful methods, you'll be provided with copious hands-on examples aimed at demonstrating, in a practical way, how to get the most out of them.

    Now that you're well aware of the main subject of this series, I'm going to take a few minutes of your valuable time to rehash the topics that were discussed in the last article. As you'll probably recall, during the course of that article, I went through the definition of a highly generic user handling class, which when implemented at a basic level, is a primitive destructor method.

    The purpose was simply to demonstrate the order in which multiple destructors were called by the PHP interpreter, when using some of the user handling objects that I mentioned earlier. The final result of this testing process was pretty obvious: the PHP engine used the same order in which these objects were constructed, to destroy them; something that was clearly shown by the respective destructors.

    Even though this particular example doesn't have a direct application in real world conditions, it should help you understand the priority scale used by the PHP parser when it comes to calling multiple destructors during the execution of a given application.

    So far, so good. Now that you hopefully remember all the details concerning the use of several destructors in PHP 5, it's time to continue learning more about these helpful methods. Therefore, in this third part of the series, I'm going to show you how to retrieve some useful information about a specific object, including its properties and methods, prior to its being destroyed by the PHP parser via the implementation of a simple destructor.

    Want to see how this will be achieved? Jump into the next few lines and begin reading now!

    More PHP Articles
    More By Alejandro Gervasio


       · In the course of this third episode of the series, you’ll learn how to retrieve...
     

       

    PHP ARTICLES

    - 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
    - Working with Multiple Document Nodes with th...




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