LMSouq
php-dev Open

What's better at freeing memory with PHP: unset() or $var = null

AL
alex
1 month ago
3 views
Problem Description
I realise the second one avoids the overhead of a function call (**update**, is actually a language construct), but it would be interesting to know if one is better than the other. I have been using `unset()` for most of my coding, but I've recently looked through a few respectable classes found off the net that use `$var = null` instead. Is there a preferred one, and what is the reasoning?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base