Should I use unset in php __destruct ()?

Is it good to undo the variables that you used in the class? Or is it optional?

If this is good practice, what is the use of using the unset function?

+6
oop php
source share
1 answer

You really don't have to worry about cleaning up variable declarations in PHP; their garbage collection takes care of all this for you. Your __destruct() methods are __destruct() intended for things like closing persistent connections.

+11
source share

All Articles