note 116179 deleted from oop4.constructor by salathe
| From: | salathe@php.net | Date: | Fri, 21 Nov 2014 14:53:33 +0000 |
| Subject: | note 116179 deleted from oop4.constructor by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200979@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
"There are no destructors in PHP. You may use register_shutdown_function() instead to simulate
most effects of destructors. "
I thought this was a particularly strange statement, seeing as that I use __construct() en
__destruct() the whole time. And surely, from http://php.net/manual/en/language.oop5.decon.php
we can read this:
"void __destruct ( void )
PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as
C++. The destructor method will be called as soon as there are no other references to a particular
object, or in any order during the shutdown sequence. "
And even:
"The destructor will be called even if script execution is stopped using exit(). Calling exit()
in a destructor will prevent the remaining shutdown routines from executing."
So PHP definitely supports destructors.