
As the PHP world eagerly anticipates the release of PHP 8.5, this update brings a wealth of developer-friendly enhancements, practical tools, and modern conveniences that streamlines everyday coding. Let’s explore what’s new, what’s improved, and what’s being phased out.
Major New Features & Improvements
1. Pipe Operator (|>)
A standout addition, the pipe operator allows clean, left-to-right chaining of single-argument callables—great for flattening nested function calls and improving readability:
$result = 'hello world'
|> strtoupper(...)
|> trim(...)
|> htmlentities(...);
This is functionally equivalent to nested calls like htmlentities(trim(strtoupper('hello world')))
2. Array Convenience Functions: array_first() & array_last()
Retrieve the first or last value of an array—associative or numeric—without manipulating the internal pointer. Returns null
for empty arrays
$users = ['Alice', 'Bob', 'Charlie'];
echo array_first($users); // 'Alice'
echo array_last($users); // 'Charlie'
These complement array_key_first() and array_key_last() introduced earlier
3. Error & Exception Handler Getters
New functions get_error_handler() and get_exception_handler() let you introspect current handlers—handy for debugging and building frameworks with layered handler logic SensioLabssaasykit.com.4. Fatal Error Stack Traces
Fatal errors now include full stack traces, unless disabled. This significantly eases debugging in complex call chains
5. New cURL Utility: curl_multi_get_handles()
Get all handles from a cURL multi-handle, simplifying concurrent request workflows
$handles = curl_multi_get_handles($multiHandle);
foreach ($handles as $h) {
// process each handle
}
6. Internationalization Helpers
locale_is_right_to_left() (and Locale::isRightToLeft()) detects whether a locale uses right-to-left text (like Arabic or Hebrew)
New IntlListFormatter class helps generate locale-aware lists (e.g., "A, B, and C" vs. German locales)
7. New Constant:PHP_BUILD_DATE
A read-only constant that provides the PHP binary’s build date—helpful for logging and environment audits
echo PHP_BUILD_DATE; // e.g., 'Nov 15 2025 10:30:45'
8. CLI Option: php --ini=diff
Quickly see only the INI directives that differ from PHP defaults:
php --ini=diff
# e.g.
memory_limit = 256M (default: 128M)
This boosts configuration debugging significantly
9. Final Property Promotion
You can now declare constructor-promoted properties as final in one line
class User {
public function __construct(
final public readonly string $name
) {}
}
Streamlined and concise—you set and lock the property at once
10. Attributes on Constants & #[\NoDiscard]
Constants can now have attributes:
#[\Deprecated]
const OLD_CONST = 1;
The new #[\NoDiscard] attribute emits a warning if a function's return value is ignored: