
CommunityNews
Why we need multi-line short closures in PHP
PHP 8.1 is already taking shape quite well, yet there’s one feature I’d love to see added, that’s still being discussed: multi-line short closures. The RFC calls them “Auto-capturing multi-statement closures” but I hope you don’t mind me using the somewhat shorter name.
If you’re on an actively supported PHP version, you already know about short closures — a.k.a. “arrow functions”. And, most importantly, one of their biggest drawbacks: they only support one-line expressions, which are also used as the return value.
The multi-line short closures RFC by Nuno and Larry aims to solve that problem, in — what I think is — an elegant way.
Read in full here:
This thread was posted by one of our members via one of our news source trackers.
First Post!

bot
Corresponding tweet for this thread:
Share link for this tweet.
Popular Backend topics










Other popular topics










Latest in Blogs/Talks
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /textmate
- /sublime-text
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /c
- /slackware
- /julia
- /neovim