Home arrow PHP arrow Retrieving Information on Several Objects with Destructors in PHP 5

Retrieving Information on Several Objects with Destructors in PHP 5

Welcome to the fourth part of the series “Understanding Destructors in PHP 5.” Made up of five comprehensive tutorials, this series brings to you the foundations of how to declare and implement destructors in PHP 5-driven classes. And it tackles this process from a practical point of view, since you’ll be able to learn these methods by using copious examples.

TABLE OF CONTENTS:
  1. Retrieving Information on Several Objects with Destructors in PHP 5
  2. Keeping track of a single object
  3. Working with different user handling objects
  4. Displaying data related to different objects using one single destructor
By: Alejandro Gervasio
Rating: starstarstarstarstar / 5
February 06, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As you know, a destructor is simply a magic method supported by the highly-improved object model of PHP 5. When implemented by a determined object, it will be automatically called by the interpreter prior to removing the object in question from the web server’s memory.

Obviously, the intrinsic nature of destructors make them very useful for performing certain tasks, right before a specific application finishes its execution and all of its objects are deleted. Therefore, if you wish to learn how to use them as part of your own PHP 5 classes, this group of educational articles might be the guide that you’ve been searching for.

Now that you know what this article series is about, it’s time to review the topics that I discussed in the last article concerning the adequate utilization of destructors with PHP 5. Put in a simple way, during the aforementioned tutorial I showed you how to implement a destructor in a useful fashion. This is because I defined a highly generic user-handling class that included into its API a destructor method that was capable of displaying on the browser the methods and properties of a specific object prior to its corresponding deletion by the PHP interpreter.

Indeed, the use of destructors to keep track of the properties (and eventually the methods) of a determined object can be relatively helpful, especially in those situations where a specific PHP 5 application requires you to trace the status of some of its objects before they are removed by the PHP engine.

And now that I've spoken of keeping track of methods and properties of certain objects via their respective destructors, in this fourth article of the series I’m going to teach you how perform this process when working with multiple objects (remember that you already learned how to achieve this using only one class instance).

Hopefully, by the end of this installment you’ll be equipped with the required background to build a simple mechanism that will permit you to keep track of the properties and methods of a bunch of objects by using the functionality provided by their respective destructors.

With the preliminaries out of our way, let’s move forward and continue learning more useful features concerning the usage of destructors with PHP 5. You’ll have a very good time, that’s guaranteed!



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: