Automatic destructor in PHP4

<?php
class demoClass{

function demoClass(){
//destructor
register_shutdown_function(array(&$this, ‘__destruct’));

//constructor
$argcv = func_get_args();
call_user_func_array(array(&$this, ‘__construct’), $argcv);
}

function __construct(){
//your code for constructor goes here
}

function __destruct(){
//your code for destructor goes here
}

}

//Hope this method help you out with your problems.

//Hope this helps you,

//Sachin (samsami2u@gmail.com)
?>

Advertisements