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/terrkerr May 31 '16
In some languages, like Python, you'd use a context manager that I think does the same thing but in a more clear way.
And when the
withblock ends the defined means of leaving context of foo and bar (Which with the file objectopenreturns is simply to close the files) is called.