A small question about the destructor (__destruct ()) of a class in PHP5.
Is it required to remove the attributes of the class in the destructor or does the mere fact that the object is destroyed, or unset () or at the end of the script enough to release, to. Similarly, data stored in its properties when executing the destructor?
Are we obliged to do this:
Code:
<?php
class MyObject
{
private $myVar;
public function __construct() { }
public function doIt() { }
public function __destruct ()
{
/ / Code or compulsory destruction of properties of the object made by implication?
unset($ this ->myVar);
}
}
>
Bookmarks