PHP

PHP 8.5: Discover the New Features

By Igor Amador
August 23, 2025
4 min min read
PHP 8.5: Discover the New Features

With a planned release on November 20, 2025, PHP 8.5 represents the next evolution of the PHP language, bringing significant improvements focused on developer experience, performance, code clarity, and more efficient debugging. In this post, we explore what PHP is, its main uses, and the highlights of this new version — as well as comparing it with previous versions and reflecting on its impact on modern development.

What is PHP

PHP (a recursive acronym for PHP: Hypertext Preprocessor) is an interpreted programming language, primarily used in server-side web development. Created by Rasmus Lerdorf in 1995, it has become a crucial foundation for content management systems, dynamic web applications, and APIs, such as:

  • Dynamic websites and CMS systems: WordPress, Joomla!, Drupal, Magento, MediaWiki, etc.
  • APIs and back-ends for modern applications, often using frameworks like Laravel or Symfony.
  • Command-line scripting (CLI), task automation, data processing, and other uses beyond the browser.
  • Database integration, XML manipulation, image generation, socket usage, among others.

New Features in PHP 8.5

Pipe Operator (|>)

Allows chaining functions in a functional and readable way, passing results from one function directly to another without intermediate variables.

Impact: makes code more fluid and expressive, especially in processing pipelines.

New Array Functions: array_first() and array_last()

Simple functions to get the first and last element of an array, including associative arrays; returns null if the array is empty.

Impact: eliminates unnecessary boilerplate and makes code clearer.

Command Line Interface: php --ini=diff

New command to display only INI directives that have been changed from the default.

Impact: facilitates diagnostics and comparisons between different environments.

PHP_BUILD_DATE and Handler Functions

Inclusion of the constant indicating the build date and functions like get_error_handler() and get_exception_handler() to inspect current handlers.

Impact: improves runtime control and introspection.

Backtraces in Fatal Errors

Generation of stack trace in cases of fatal error — facilitates problem location.

Impact: more efficient debugging, especially in production.

Closures and Callables in Constant Expressions

Allows the use of anonymous functions and callables in const, including first-class callables, which was not possible before.

Impact: enhances code declarativeness and flexibility at compile time.

#[\NoDiscard] Attribute and Cast (void)

Introduces a mechanism to force the use of return values from important functions and indicate explicit return discarding.

Impact: prevents bugs by reinforcing good practices in method usage.

Asymmetric Visibility in Static Properties

Supports public private(set) in static attributes — public reading and writing restricted to the class.

Impact: reinforces encapsulation without extra complexity.

Performance and Security Improvements

Optimizations in BCMath (using stack instead of heap), XMLWriter, opcache directives (opcache.file_cache_read_only, opcache.jit_hot_loop), and bug fixes such as UAF, overflows, and memory leaks.

Impact: faster applications, lower chances of critical failures, and greater stability.

New Localization Methods

Includes the locale_is_right_to_left() function and Locale::isRightToLeft() method.

Impact: facilitates support for RTL (right-to-left) languages, such as Arabic and Hebrew.

Feature / VersionPHP 8.4 and earlierPHP 8.5
Pipe Operator (``)Manual chaining (variables)
array_first() / array_last()Boilerplate (reset, keys)Native and direct functions
CLI --ini=diffFull phpinfo outputShows only changes
Build Date and HandlersIndirect accessSpecific constant and functions
Backtraces in Fatal ErrorsNo complete traceBacktrace available
Closures/Callables in constNot allowedAllowed
#[\NoDiscard] / (void)Non-existentAvailable
Asymmetric visibilityNot applied to staticsFull support
Optimizations (BCMath, XML, Opcache)LimitedIntegrated improvements
RTL LocalizationLimited supportSpecific APIs

Conclusion

PHP 8.5, scheduled for November 20, 2025, doesn’t rewrite the language but delivers practical improvements that make development more efficient, robust, and elegant. Features like the pipe operator, new array functions, better debugging tools, and enhanced security reflect a clear focus on developer experience and the survival of applications in real production environments.

The update promises to be smooth for those already on the 8.x line, offering clear benefits with little friction in migration. It’s recommended to test alpha and beta versions in development environments to become familiar before full adoption in production.

Tags:#PHP#PHP 8.5#PROGRAMMING

Related Articles