A destructor in a PHP class is defined using the __destruct() method.

  • method
  • function
  • keyword
  • property
In PHP, a destructor in a class is defined using the __destruct() method. The correct option is "method." The __destruct() method is a special method that is automatically called when an object is no longer referenced or explicitly destroyed. It is used to perform any necessary cleanup tasks or deallocate resources held by the object. For further details, refer to the PHP documentation on destructors: https://www.php.net/manual/en/language.oop5.decon.php#language.oop5.decon.destruct
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *