Search code examples
phpclassobjectdestroy

How to destroy a class object in PHP?


I wrote a little class for storing global variables/functions. My question is - is it necessary to destroy the class object after the script has finished? or will PHP destroy that object itself?

Here's my code:

$web=new c_web("myWeb");
$web->loadTemplate("/!framework/admin/template.htm");
$web->doStuff();
// script has finished - destroying required here?

In case I need to destroy it, how can I do that?


Solution

  • If the script finishes, the memory is released. You're ready as is :)