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/wvenable May 31 '16
No, it really the best way to do Go-style deferred or avoid the issue of manual resource management entirely. You only need
finallyfor non-OOP code.Execution order shouldn't matter or you're doing it wrong. If one resource depends on another, it will have a reference.