{"id":1077,"date":"2025-08-20T14:07:54","date_gmt":"2025-08-20T14:07:54","guid":{"rendered":"https:\/\/www.woodcentral.com\/-\/peter\/?p=1077"},"modified":"2026-05-24T11:28:10","modified_gmt":"2026-05-24T11:28:10","slug":"whats-new-in-php-8-4","status":"publish","type":"post","link":"https:\/\/www.woodcentral.com\/-\/peter\/whats-new-in-php-8-4\/","title":{"rendered":"What\u2019s new in PHP 8.4"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Released: November\u00a021,\u00a02024 \u2022 Active support: 2 years \u2022 Security support: +2 years \u2022 EOL: December\u00a031,\u00a02028<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Key New Features<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">1) Property Hooks<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Define <code>get<\/code> and\/or <code>set<\/code> hooks directly on properties to reduce boilerplate and enable virtual properties.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Example (illustrative)\nclass User {\n    public string $name {\n        get { return ucfirst($this-&gt;_name); }\n        set { $this-&gt;_name = trim($value); }\n    }\n    private string $_name = '';\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2) Asymmetric Visibility<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Allow different visibility for reading vs. writing a property.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Post {\n    public private(set) string $slug;\n    public function __construct(string $slug) {\n        $this-&gt;slug = $slug; \/\/ write allowed here\n    }\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3) Chain <code>new<\/code> Without Parentheses<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Parentheses are no longer required when chaining after <code>new<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$request = new Request()-&gt;withMethod('GET')-&gt;withUri('\/hello');<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4) New Array Helpers<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>array_find()<\/code> \u2013 first matching element<\/li>\n\n\n\n<li><code>array_find_key()<\/code> \u2013 key of first match<\/li>\n\n\n\n<li><code>array_any()<\/code> \u2013 any element matches<\/li>\n\n\n\n<li><code>array_all()<\/code> \u2013 all elements match<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>$n = array_find($numbers, fn($x) =&gt; $x % 2 === 0); \/\/ first even<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5) HTML5 DOM<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">New DOM classes add proper HTML5 parsing and manipulation (beyond legacy HTML4 limitations).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6) Multibyte String Additions<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>mb_trim()<\/code>, <code>mb_ltrim()<\/code>, <code>mb_rtrim()<\/code><\/li>\n\n\n\n<li><code>mb_ucfirst()<\/code>, <code>mb_lcfirst()<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">7) BCMath<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>bcdivmod()<\/code> combines division and modulus for arbitrary-precision numbers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8) Intl \/ Grapheme \/ cURL updates<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>grapheme_str_split()<\/code><\/li>\n\n\n\n<li>Intl: <code>intltz_get_iana_id()<\/code>, <code>IntlTimeZone::getCanonicalID()<\/code><\/li>\n\n\n\n<li>cURL: HTTP\/3-related constants and options; new timing info fields<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">9) Other Notables<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>phpinfo()<\/code> shows integer size<\/li>\n\n\n\n<li>New rounding behavior (invalid modes throw <code>ValueError<\/code>)<\/li>\n\n\n\n<li>DateTime\/Immutable: <code>createFromTimestamp()<\/code>, <code>getMicrosecond()<\/code>, <code>setMicrosecond()<\/code><\/li>\n\n\n\n<li>HTTP helpers: <code>request_parse_body()<\/code>, <code>http_get_last_response_headers()<\/code>, <code>http_clear_last_response_headers()<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax &amp; Functional Changes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>exit<\/code> and <code>die<\/code> are now functions (not language constructs)<\/li>\n\n\n\n<li>Default bcrypt cost increased from 10 \u2192 12<\/li>\n\n\n\n<li><code>PHP_ZTS<\/code> and <code>PHP_DEBUG<\/code> now booleans<\/li>\n\n\n\n<li>Raised minimums: OpenSSL \u2265 1.1.1, libcurl \u2265 7.61.0<\/li>\n\n\n\n<li><code>CURLOPT_DNS_USE_GLOBAL_CACHE<\/code> ignored<\/li>\n\n\n\n<li>mbstring Unicode Character Database updated<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Deprecations<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Implicitly nullable type declarations<\/li>\n\n\n\n<li><code>E_STRICT<\/code> constant<\/li>\n\n\n\n<li><code>session_set_save_handler()<\/code> with > 2 args<\/li>\n\n\n\n<li>CSV functions without explicit <code>$escape<\/code> parameter<\/li>\n\n\n\n<li><code>SUNFUNCS_RET_*<\/code> constants<\/li>\n\n\n\n<li><code>CURLOPT_BINARYTRANSFER<\/code><\/li>\n\n\n\n<li>\u2026and more as part of ongoing cleanup<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Removals \/ Moved to PECL<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Pspell<\/code><\/li>\n\n\n\n<li><code>IMAP<\/code><\/li>\n\n\n\n<li><code>OCI8<\/code>, <code>PDO-OCI<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Release &amp; Support<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Release:<\/strong> November 21, 2024<br><strong>Support policy:<\/strong> 2 years active (bugs &amp; security) + 2 years security-only<br><strong>End of life:<\/strong> December 31, 2028<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary Table<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Category<\/th><th>Highlights<\/th><\/tr><\/thead><tbody><tr><td><strong>New Capabilities<\/strong><\/td><td>Property hooks, asymmetric visibility, chainable <code>new<\/code>, array helpers, HTML5 DOM, new <code>mb_*<\/code>, BCMath, Intl\/Grapheme\/cURL updates<\/td><\/tr><tr><td><strong>Syntax \/ Internals<\/strong><\/td><td><code>exit<\/code>\/<code>die<\/code> become functions; bcrypt cost\u2191; rounding throws on invalid modes; updated libs &amp; UCD<\/td><\/tr><tr><td><strong>Deprecated<\/strong><\/td><td>Implicit nullable types, <code>E_STRICT<\/code>, <code>session_set_save_handler()<\/code> (3+ args), CSV escape default, sunfuncs constants, etc.<\/td><\/tr><tr><td><strong>Removed<\/strong><\/td><td><code>Pspell<\/code>, <code>IMAP<\/code>, <code>OCI8<\/code>, <code>PDO-OCI<\/code> moved to PECL<\/td><\/tr><tr><td><strong>Release<\/strong><\/td><td>Nov 21, 2024 \u2022 EOL Dec 31, 2028<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Tip: Test on a staging environment and enable deprecation warnings to prep for 8.5.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Released: November\u00a021,\u00a02024 \u2022 Active support: 2 years \u2022 Security support: +2 years \u2022 EOL: December\u00a031,\u00a02028 Key New Features 1) Property Hooks Define get and\/or set hooks directly on properties to reduce boilerplate and enable virtual properties. 2) Asymmetric Visibility Allow different visibility for reading vs. writing a property. 3) Chain new Without Parentheses Parentheses are &#8230; <a title=\"What\u2019s new in PHP 8.4\" class=\"read-more\" href=\"https:\/\/www.woodcentral.com\/-\/peter\/whats-new-in-php-8-4\/\" aria-label=\"Read more about What\u2019s new in PHP 8.4\">Read more<\/a><\/p>\n","protected":false},"author":7,"featured_media":1078,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1077","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/posts\/1077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/comments?post=1077"}],"version-history":[{"count":0,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/posts\/1077\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/media\/1078"}],"wp:attachment":[{"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/media?parent=1077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/categories?post=1077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.woodcentral.com\/-\/peter\/wp-json\/wp\/v2\/tags?post=1077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}