Released: November 21, 2024 • Active support: 2 years • Security support: +2 years • EOL: December 31, 2028
Key New Features
1) Property Hooks
Define get and/or set hooks directly on properties to reduce boilerplate and enable virtual properties.
// Example (illustrative)
class User {
public string $name {
get { return ucfirst($this->_name); }
set { $this->_name = trim($value); }
}
private string $_name = '';
}
2) Asymmetric Visibility
Allow different visibility for reading vs. writing a property.
class Post {
public private(set) string $slug;
public function __construct(string $slug) {
$this->slug = $slug; // write allowed here
}
}
3) Chain new Without Parentheses
Parentheses are no longer required when chaining after new.
$request = new Request()->withMethod('GET')->withUri('/hello');
4) New Array Helpers
array_find()– first matching elementarray_find_key()– key of first matcharray_any()– any element matchesarray_all()– all elements match
$n = array_find($numbers, fn($x) => $x % 2 === 0); // first even
5) HTML5 DOM
New DOM classes add proper HTML5 parsing and manipulation (beyond legacy HTML4 limitations).
6) Multibyte String Additions
mb_trim(),mb_ltrim(),mb_rtrim()mb_ucfirst(),mb_lcfirst()
7) BCMath
bcdivmod() combines division and modulus for arbitrary-precision numbers.
8) Intl / Grapheme / cURL updates
grapheme_str_split()- Intl:
intltz_get_iana_id(),IntlTimeZone::getCanonicalID() - cURL: HTTP/3-related constants and options; new timing info fields
9) Other Notables
phpinfo()shows integer size- New rounding behavior (invalid modes throw
ValueError) - DateTime/Immutable:
createFromTimestamp(),getMicrosecond(),setMicrosecond() - HTTP helpers:
request_parse_body(),http_get_last_response_headers(),http_clear_last_response_headers()
Syntax & Functional Changes
exitanddieare now functions (not language constructs)- Default bcrypt cost increased from 10 → 12
PHP_ZTSandPHP_DEBUGnow booleans- Raised minimums: OpenSSL ≥ 1.1.1, libcurl ≥ 7.61.0
CURLOPT_DNS_USE_GLOBAL_CACHEignored- mbstring Unicode Character Database updated
Deprecations
- Implicitly nullable type declarations
E_STRICTconstantsession_set_save_handler()with > 2 args- CSV functions without explicit
$escapeparameter SUNFUNCS_RET_*constantsCURLOPT_BINARYTRANSFER- …and more as part of ongoing cleanup
Removals / Moved to PECL
PspellIMAPOCI8,PDO-OCI
Release & Support
Release: November 21, 2024
Support policy: 2 years active (bugs & security) + 2 years security-only
End of life: December 31, 2028
Summary Table
| Category | Highlights |
|---|---|
| New Capabilities | Property hooks, asymmetric visibility, chainable new, array helpers, HTML5 DOM, new mb_*, BCMath, Intl/Grapheme/cURL updates |
| Syntax / Internals | exit/die become functions; bcrypt cost↑; rounding throws on invalid modes; updated libs & UCD |
| Deprecated | Implicit nullable types, E_STRICT, session_set_save_handler() (3+ args), CSV escape default, sunfuncs constants, etc. |
| Removed | Pspell, IMAP, OCI8, PDO-OCI moved to PECL |
| Release | Nov 21, 2024 • EOL Dec 31, 2028 |
Tip: Test on a staging environment and enable deprecation warnings to prep for 8.5.