Hello!
In modern PHP, the garbage collector (GC) is not a mandatory component,
provided that the code is written without circular dependencies. As soon as
an object loses its last reference (i.e., its reference count reaches
zero), PHP immediately frees the resources. In this sense, you can think
Hello, folks. If this is not the correct place to ask, I apologize.
> TL;DR: Does setting a variable to `null` (or even `unset`ing it) have **any**
> effect if that's the last instruction of a function?
The full version of the question with context:
I have a question about the inner workings of
Assuming that the variable gets created in the scope of the function
and that it never leaks outside of the scope (e.g. by reference), then
you can consider these things:
PHP will destroy the object when there are no more references to it in
the running script[1]. So, if the PDO object is limited
On 10 March 2025 16:15:16 GMT, Vinicius Dias wrote:
>Hello, folks. If this is not the correct place to ask, I apologize.
>
>> TL;DR: Does setting a variable to `null` (or even `unset`ing it) have
>> **any** effect if that's the last instruction of a function?
>
>The full version of the question w
Hi Vinicius
On Mon, Mar 10, 2025 at 5:15 PM Vinicius Dias wrote:
>
> > TL;DR: Does setting a variable to `null` (or even `unset`ing it) have
> > **any** effect if that's the last instruction of a function?
As others have pointed out, it is _almost_ completely unobservable.
There are two small d