Small appreciation post for PHP8

Does anyone ever write closures in PHP lol. besides the currently awful syntax, I've never really used it in my 3+ years of professional PHP development or my many years of casual development.

I feel like closures make a lot more sense when used in an async task that runs within its own scope like in Javascript or functional programming languages like haskell. But in languages like PHP or even python, closures/lambdas just never really made any sense for me to use. At that point, just define a protected function within the class to be used only as a helper function and you're also making the code easier to read, IMO, by removing lambdas sitting in the middle of a function/body of code

In PHP, and I might be wrong, but closures just seem like syntax sugar mostly, besides the ability to bind variables to the scope but since callbacks are rarely used, it seems like a moot point. And if you're working with classes, you don't need to even bind variables to the scope when you should really just be using class properties and then you can have access to those values without passing it around to functions.

/r/PHP Thread Parent