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

Keeping Track of Objects when Using Destructors in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 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:
      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


    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
     

       

    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 1 hosted by Hostway
    Stay green...Green IT