note 51935 deleted from language.oop5.decon by cmb
| From: | cmb@php.net | Date: | Mon, 07 Sep 2015 21:23:56 +0000 |
| Subject: | note 51935 deleted from language.oop5.decon by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203732@lists.php.net to get a copy of this message | ||
Note Submitter: contact at tcknetwork dot com
----
Note that php5 use in priority __construct() instead of [classname](). So you could build a
constructed/destructed class for php4/5 very easily using this.
<?
class test {
function test() {
$this->__construct();
register_shutdown_function(array($this,"__destruct"));
}
function __construct() {
echo "construct\n";
}
function __destruct() {
echo "destruct\n";
}
};
$t=new test();
?>
In case you use unset($t) in php4, the destructor is not called. so be careful.