PHP
  Home arrow PHP arrow Executing Destructors Manually in PHP ...
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 
OLM
 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

Executing Destructors Manually in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2008-02-13

    Table of Contents:
  • Executing Destructors Manually in PHP 5
  • Triggering a destructor manually
  • Calling multiple destructors manually
  • Emulating destructors in PHP 4

  • 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

    Anyone looking for a way to modernize legacy data or easily migrate to a more cost-effective database without sacrificing functionality will benefit from this seminar. View the Intro to Advantage Database Server now!

    Executing Destructors Manually in PHP 5
    (Page 1 of 4 )

    Welcome to the final chapter of the series “Understanding Destructors in PHP 5.” In consonance with this article’s title, this series walks you through the basics of utilizing class destructors in object-based applications and also provides you with a decent number of hands-on examples, so you can start incorporating these useful methods into your PHP 5 classes with minor efforts.

    If you’re a PHP developer who has spent a considerable amount of time using the set of brand new features incorporated into the object model of PHP 5, then there’s the possibility that you’ve already worked with class destructors. However, you may want to refresh their foundations or simply fill some gaps regarding their adequate implementation, so don’t hesitate to start reading this article series now!

    Now that you hopefully have a clear idea on the purpose of this article series, it’s an appropriate moment to make a brief recapitulation about the items that were discussed in great detail during the previous tutorial of the series. As you’ll surely recall, in that particular installment I demonstrated how to retrieve useful information about a few user handling objects, such as their respective properties and methods, prior to being removed by the PHP engine.

    This process was performed successfully by way of a single destructor method whose implementation consisted first of iterating over the properties and methods of a particular object, and then displaying this data on the browser. By using this simple, yet effective, approach it was possible to build a mechanism that printed structural information on a specific object onto the screen right before being destroyed by the PHP interpreter.

    All right, at this point I should assume that implementing destructors in a useful way is now a familiar concept to you, which may lead you to erroneously think that the topic doesn’t bear further discussion. Well, not so fast, since there’s an important point that still remains uncovered and here it comes:

    As you learned so far, destructors were called automatically by the PHP engine before finishing the execution of a determined script. However, did you ever think that these methods could be forced to run manually? Yes, you’re correct! If you purposely delete an object that implements a destructor, logically it will be called without the need to abruptly terminate the execution of a given script. Sounds quite interesting, right?

    Therefore, in this final tutorial of the series I’m going to show you how to manually trigger a destructor, and in addition you’ll learn how to emulate the behavior of this magic method when using PHP 4.

    Are you ready to tackle this last chapter of this educational journey? Let’s get started!

    More PHP Articles
    More By Alejandro Gervasio


       · Over the course of this final episode of the series, you’ll learn you how to trigger...
     

       

    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...

     
    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 5 hosted by Hostway