samedi 20 août 2016

PHP clearing memory for an array of objects

I have a class, which (among other things) contains a simple array of objects instanced from another class. (This array is small - containing only 1 to perhaps 4 objects.)

In the __destruct method of the first class I want to clear the contents (free the memory) of this array of objects. In order to do this, do I:

  1. iterate through the array, setting each index = null, then finally setting the array = null?

  2. simply set the array = null?

Aucun commentaire:

Enregistrer un commentaire