01
URI Extension
The new always-available URI extension provides APIs to securely parse and modify URIs and URLs according to the RFC 3986 and the WHATWG URL standards.Powered by the uriparser (RFC 3986) and Lexbor (WHATWG URL) libraries.Learn more about the backstory of this…
02
Pipe Operator
The pipe operator allows chaining function calls together without dealing with intermediary variables. This enables replacing many "nested calls" with a chain that can be read forwards, rather than inside-out.Learn more about the backstory of this feature in…
03
Clone With
It is now possible to update properties during object cloning by passing an associative array to the clone() function. This enables straightforward support of the "with-er" pattern for readonly classes. PHP 8.4 and older readonly class Color { public function…
04
#[\NoDiscard] Attribute
By adding the #[\NoDiscard] attribute to a function, PHP will check whether the returned value is consumed and emit a warning if it is not. This allows improving the safety of APIs where the returned value is important, but it's easy to forget using the…
05
Closures and First-Class Callables in Constant Expressions
Static closures and first-class callables can now be used in constant expressions. This includes attribute parameters, default values of properties and parameters, and constants. PHP 8.4 and older final class PostsController { #[AccessControl( new…
06
Persistent cURL Share Handles
Unlike curl_share_init(), handles created by curl_share_init_persistent() will not be destroyed at the end of the PHP request. If a persistent share handle with the same set of share options is found, it will be reused, avoiding the cost of initializing cURL…
07
array_first() and array_last() functions
The array_first() and array_last() functions return the first or last value of an array, respectively. If the array is empty, null is returned (making it easy to compose with the ?? operator). PHP 8.4 and older $lastEvent = $events === [] ? null…