unset(variables) even at the end of the execution?

Marcus

Well-known member
I unset some variables at the end of a xenforo cron.

Is it true that the cron is executed separately, and only the one single php file which I execute (like XenForo_CronEntry_MyCron.php) is executed by php? Not other php code is processed?

If that's the case, the script is actually at it's end and the variables are unset once the script finished it's execution. So it is not useful to unset the variable.
 
It never hurts to unset variables, but it's not really required if you don't want to achieve something specific with it either. There are some special cases where you should clear a huge set of data (an array with 80.000+ entries for example), but I'd never bother to unset a single integer or even an array if not necessary for something else. Variables only exist only within their class/function anyway and are unset after execution.
 
unsetting variables really matters if you are doing a hell of a lot in the one function, otherwise php will garbage collect once the function exits.
 
Back
Top Bottom