A Close Look at Golang's defer
I’ve never come across anything like Go’s defer in any of the languages I’ve worked on before. As far as I know there isn’t an equivalent of it in PHP and the closest we have in Java is try-with-resources. If you’ve been coding in Go you’ve probably used the defer statement plenty of times. ...