PHP Classes

File: DESTRUCTOR.php

Recommend this page to a friend!
  Classes of Bryan Smith   Destructor   DESTRUCTOR.php   Download  
File: DESTRUCTOR.php
Role: Class source
Content type: text/plain
Description: DESTRUCTOR Class
Class: Destructor
Implement class destructors under PHP 4
Author: By
Last change:
Date: 18 years ago
Size: 914 bytes
 

Contents

Class file image Download
<?php
/**
 * Destructor class for PHP4 implementations.
 * Copyright (C) 2005 - Bryan Smith
 */

$ClassNameObjects = array();

/**
 * Shutdown function which will all all DESTORY_() commands for subsequent classes;
 *
 */
function ClassNameDestructor()
{
    global
$ClassNameObjects;

    if (
count($ClassNameObjects))
    {
       
$ClassnameObject = array_reverse($ClassNameObjects);
       
reset($ClassNameObjects);
       
        while(list(,
$Obj) = each($ClassNameObjects))
           
$Obj->__destructor();

       
$ClassNameObjects = null;
    }
}

register_shutdown_function("ClassNameDestructor");

class
DESTRUCTOR
{
   
/**
     * References child class into global array.
     *
     * @return DESTRUCTOR
     */
   
function DESTRUCTOR()
    {
        global
$ClassNameObjects;
       
$ClassNameObjects[] = &$this;
    }

   
/**
     * DESTROY_() template.
     *
     */
   
function __destructor()
    {
       
// Default for child destroy
   
}
}

?>