Maico
Maico

Reputation: 171

Automatic Garbage Collection

I have an list of items that is stored in the $_SERVER["my_key"]. Are these items garbage collected automatically?

Upvotes: 1

Views: 263

Answers (2)

Tobias P.
Tobias P.

Reputation: 4664

$_SERVER is a superglobal array and all values in this array will be the one and only time garbage collected when the script finishes execution.

Upvotes: 1

Piskvor left the building
Piskvor left the building

Reputation: 92792

If there's nothing referencing the list (e.g. when you unset($_SERVER['my_key'])), it will be GC'd sooner or later (at the latest, when your script terminates).

Upvotes: 2

Related Questions