How to destroy a class object in PHP?

Fuxi picture Fuxi · Apr 8, 2011 · Viewed 8.4k times · Source

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?

Answer

Nanne picture Nanne · Apr 8, 2011

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