Should I use unset in php __destruct()?

后端 未结 1 1635
难免孤独
难免孤独 2020-12-20 19:57

Is it a good practice to unset the variables that you used in a class? Or its an optional?

If its a good practice what is the benefit of using the unset

相关标签:
1条回答
  • 2020-12-20 20:17

    You really don't need to worry about cleaning up your variable declarations in PHP, its garbage collection takes care of all of that for you. Your __destruct() methods are primarily for things like closing persistent connections.

    0 讨论(0)
提交回复
热议问题