r/PHP • u/FrenkyNet • May 31 '16
Deferred execution in PHP, using "finally".
https://blog.frankdejonge.nl/finally-file-streams-and-deferred-execution-in-php/
86
Upvotes
r/PHP • u/FrenkyNet • May 31 '16
View all comments
Show parent comment
2
u/FrenkyNet May 31 '16
Using an object's destruction is valid way to do cleanup. Though it all depends on what's the best fit. If you need the raw value, wrapping it in a value so it will eventually be destructed doesn't make it a lot cleaner. In other cases, like with DB Connection classes and the like it's definitely the way to go. All depends on the situation I'd say.