开发者

Should I use unset in php __destruct()?

开发者 https://www.devze.com 2022-12-20 12:06 出处:网络
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 开发者_如何学Gothe unset function?You really don\'t nee

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 开发者_如何学Gothe unset function?


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

精彩评论

暂无评论...
验证码 换一张
取 消