PHP 8.5 adds built-in URI extension, pipe operator, updated clone syntax, and much more

PHP 8.5 adds built-in URI extension, pipe operator, updated clone syntax, and much more

PHP 8.5 has been released as the latest version of this widely used scripting language, bringing significant updates aimed at web developers. Among the most prominent additions, a built-in URI extension allows developers to parse, normalize, and handle URLs according to RFC 3986 and WHATWG URL standards. The new pipeline operator | enables left-to-right chaining of callables, making data flow through functions simpler without relying on intermediate variables.

Following these core changes, the release introduces an updated clone() syntax, offering a streamlined way to clone objects and set properties for immutable, or readonly, classes in one step. API safety receives attention with the #[\NoDiscard] attribute, which generates warnings if a return value goes unused. In addition, static closures and first-class callables can now appear in constant expressions, such as attribute parameters, providing developers more flexibility.

Efficiency improvements include the ability for handles to persist across multiple PHP requests, reducing the overhead of connection initializations. Developers also gain new utility with the array_first() and array_last() functions, which reliably extract the first or last value or null from arrays. PHP 8.5 also brings further feature additions, deprecations, and some backward compatibility breaks.

by Paul

na
cz
ruvenssgwilches
nabbisen found this interesting
PHP iconPHP
  469
  • ...

PHP is a server-side scripting language tailored for web development, allowing HTML embedment and benefiting from extensive community support. It excels in creating dynamic content and is recognized for its object-oriented capabilities and portability. Rated 4.4, PHP remains a popular choice for developers. Key alternatives include Python, Ruby, and JavaScript.

No comments so far, maybe you want to be first?
Gu