unset() deprecated?

Marcus

Well-known member
I remember reading through lots of unset() statements in earlier xenforo code, maybe it was even another software. But now xenforo rarely uses unset when variables are not needed any more within the functions. Is there a common rule about when unsetting a variable or doesn't it matter so much?
 
Unset certainly isn't deprecated. It's use case is simply, if you need to unset something you use it. If you don't, you don't.
 
My question is whether there is a common rule (best practise) when to use unset. Lots of variables in the Controller not passed to the View are not unset. In ControllerPublic::actionIndex() the obviously small variables $forumId, $forumName and the variable $profilePostModel are not passed to the View, and they are not unset. Usually larger arrays are unset like $thread in ControllerPublic::actionForum. Is there a definition or common rule when there is a need to unset a variable?
 
Top Bottom