What’s New in PHP 8.5: A Look at the Upcoming Release
PHP 8.5 is the next major version of PHP, currently in active development and set to reach General Availability (GA). As the latest branch, it introduces several exciting features, performance improvements, and new functionalities that developers can leverage for modern web development. This blog post dives into the key additions and changes in PHP 8.5, based on the latest updates from PHP.Watch. Let’s explore what’s coming!
1. Pipe Operator (|>
)
The pipe operator (|>
) is a new syntactic feature that allows developers to chain function calls in a more readable way. It passes the output of one function as the input to the next, streamlining data transformations and reducing nested function calls. This addition makes PHP code more concise and easier to follow, especially for functional programming enthusiasts.
2. New curl_multi_get_handles
Function
PHP 8.5 enhances the Curl extension with the curl_multi_get_handles
function. This allows developers to retrieve all active handles in a multi-curl session, improving the management of concurrent HTTP requests. This is particularly useful for applications that rely heavily on parallel API calls or data fetching.
3. New PHP_BUILD_DATE
Constant
A new PHP_BUILD_DATE
constant has been introduced, providing the build date of the PHP version in use. This can be helpful for debugging, logging, or ensuring compatibility in environments where the PHP version and its build details matter.
4. Exception and Error Handler Functions
PHP 8.5 adds get_exception_handler
and get_error_handler
functions, enabling developers to retrieve the currently set exception and error handlers. This improves debugging and error management, allowing for more dynamic and flexible error-handling strategies in applications.
5. Stack Trace Support for Fatal Errors
Fatal errors in PHP 8.5 now include stack trace support, making it easier to pinpoint the source of critical issues. This enhancement simplifies debugging by providing more context about the execution path leading to a fatal error.
6. Right-to-Left Locale Support
The new locale_is_right_to_left
function and Locale::isRightToLeft
method allow developers to check if a given locale is written right-to-left (e.g., Arabic or Hebrew). This is a significant addition for applications targeting multilingual audiences, ensuring proper text rendering and UI adjustments.
7. New array_first
and array_last
Functions
PHP 8.5 introduces array_first
and array_last
functions to directly access the first and last elements of an array. These functions simplify array manipulation, reducing the need for workarounds like reset()
or end()
and improving code readability.
8. CLI: php --ini=diff
Command
The PHP Command Line Interface (CLI) now supports the php --ini=diff
option, which outputs non-default INI directives. This is a handy tool for developers to quickly identify custom configurations in their PHP environment, aiding in debugging and server setup.
9. Internationalization Improvements: IntlListFormatter
Class
The Intl
extension gains the IntlListFormatter
class, which formats lists of items according to locale-specific rules. This is particularly useful for creating natural-language lists (e.g., “apples, bananas, and oranges”) that adhere to cultural conventions, enhancing the user experience in internationalized applications.
10. Additional Enhancements
- Improved Grapheme Support: The new
grapheme_levenshtein
function calculates the Levenshtein distance between strings while respecting grapheme clusters, improving string comparison for non-Latin scripts. - Locale Subtag Management: The
Locale::addLikelySubtags
andLocale::minimizeSubtags
methods simplify handling of locale subtags, making it easier to work with complex locale identifiers. - NumberFormatter Enhancements: The
NumberFormatter
class now supportsDECIMAL_COMPACT_SHORT
andDECIMAL_COMPACT_LONG
formats for more flexible number formatting.
Important Notes for Developers
PHP 8.5 is still a development branch and not recommended for production use until its GA release in November 2025. Developers can test the alpha releases (e.g., PHP 8.5.0alpha4) to explore new features and provide feedback. To get started, you can:
- Clone the PHP 8.5 source code from the PHP Git repository using
git clone https://github.com/php/php-src.git --depth 1 --branch php-8.5.0alpha1
. - Compile PHP by setting up dependencies, running
./buildconf
, configuring with./configure
, and building withmake
. Detailed guides are available for Ubuntu/Debian and Fedora/RHEL systems. - Use Non-Thread Safe (NTS) builds for web servers like Nginx or Caddy, or Thread-Safe (TS) builds for multithreaded servers.
Context of PHP 8.5 in the PHP Ecosystem
PHP 8.5 builds on the advancements of previous versions:
- PHP 8.4 introduced property hooks, asymmetric visibility, lazy objects, and HTML5 support in the DOM extension.
- PHP 8.3, the current stable version, offers typed class constants and granular DateTime exceptions.
- PHP 8.2 and PHP 8.1 brought features like readonly classes, enums, and fibers, but are now in security-fix-only mode and will reach End-of-Life in December 2026 and December 2025, respectively.
Upgrading to PHP 8.5 when it becomes stable will ensure access to the latest features and performance improvements, while maintaining compatibility with modern development practices.
Conclusion
PHP 8.5 is shaping up to be a powerful release with features that enhance developer productivity, code readability, and internationalization support. From the pipe operator to improved error handling and locale-aware formatting, this version promises to make PHP development more efficient and robust. Keep an eye on the PHP.Watch website for updates, changelogs, and release notes as the November 2025 launch approaches. Start experimenting with the alpha releases today to prepare for a smooth transition to PHP 8.5!