{"id":1622,"date":"2024-12-19T08:24:30","date_gmt":"2024-12-19T08:24:30","guid":{"rendered":"https:\/\/200oksolutions.com\/blog\/?p=1622"},"modified":"2025-12-04T07:44:05","modified_gmt":"2025-12-04T07:44:05","slug":"whats-new-in-php-8-4-key-features-and-improvements","status":"publish","type":"post","link":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/","title":{"rendered":"What&#8217;s New in PHP 8.4: Key Features and Improvements"},"content":{"rendered":"\n<p><strong>PHP 8.4<\/strong>, set to be released on <strong>November 21, 2024<\/strong>, brings an exciting wave of new features, enhancements, and performance updates. From property hooks to enhanced HTML5 support, PHP 8.4 aims to simplify code and improve developer experience. Let&#8217;s dive into the most significant updates!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1.&nbsp; Property Hooks<\/h2>\n\n\n\n<p>Property hooks are a game-changer for modern PHP development. They allow developers to define custom getters and setters directly within properties, reducing boilerplate code dramatically.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example:<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>class BookViewModel\n{\npublic function  construct( private array $authors\n) {}\npublic string $credits { get {\nreturn implode(', ', array_map(\nfn (Author $author) =&gt; $author-&gt;name,\n$this-&gt;authors\n));\n}\n}\npublic Author $mainAuthor { set (Author $mainAuthor) {\n$this-&gt;authors&#91;] = $mainAuthor;\n$this-&gt;mainAuthor = $mainAuthor;\n}\nget =&gt; $this-&gt;mainAuthor;\n}\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Key Points:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Hooks can be defined using get and set directly in property declarations.<\/li>\n\n\n\n<li><span style=\"background-color: var(--wp--preset--color--white); color: var(--wp--preset--color--text-primary); font-family: var(--wp--preset--font-family--raleway); font-size: var(--wp--preset--font-size--medium);\">Properties with only a get hook act as <\/span><strong style=\"background-color: var(--wp--preset--color--white); color: var(--wp--preset--color--text-primary); font-family: var(--wp--preset--font-family--raleway); font-size: var(--wp--preset--font-size--medium);\">virtual read-only properties<\/strong><span style=\"background-color: var(--wp--preset--color--white); color: var(--wp--preset--color--text-primary); font-family: var(--wp--preset--font-family--raleway); font-size: var(--wp--preset--font-size--medium);\">.<\/span><\/li>\n\n\n\n<li>Property hooks can also be defined in <strong>interfaces<\/strong>, making this a flexible addition.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>interface HasAuthors\n\n{\n\npublic string $credits { get; }\n\npublic Author $mainAuthor { get; set; }\n\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2 Method Chaining with new Without Parentheses<\/h2>\n\n\n\n<p>PHP 8.4 simplifies the syntax for chaining methods or properties on a new instance. You no longer need parentheses for instantiation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Before PHP 8.4:<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$name = (new ReflectionClass($objectOrClass))-&gt;getShortName();<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>In PHP 8.4:<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$name = new ReflectionClass($objectOrClass)-&gt;getShortName();<\/code><\/pre>\n\n\n\n<p>This improvement also works for properties, constants, and static methods, reducing clutter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3 Asymmetric Visibility: Flexible Property Access<\/h2>\n\n\n\n<p>Asymmetric visibility allows you to set <strong>different access levels <\/strong>for reading and writing class properties. For example, a property can be public for reading but private for writing.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class BookViewModel\n{\npublic private(set) Author $author;\n}<\/code><\/pre>\n\n\n\n<p>Here, $author can be read publicly but can only be modified within the class.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Shorthand Option:<\/h3>\n\n\n\n<p>If the property is public by default, you can simply write:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>private(set) Author $author; \/\/ Same as public private(set)<\/code><\/pre>\n\n\n\n<p>Asymmetric visibility also works for <strong>promoted properties<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public function   construct(private(set) Author $author) {}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4 Array_find and Related Utility Functions<\/h2>\n\n\n\n<p>A new native function array_find() has been introduced to retrieve the first element in an array that matches a condition.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$posts = &#91;...];\n\n$firstMatch = array_find($posts, function (Post $post) { return strlen($post-&gt;title) &gt; 5;\n\n});<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Additional Variants:<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>array_find_key() &#8211; Find the key of the first matching element.<\/li>\n\n\n\n<li><span style=\"background-color: var(--wp--preset--color--white); color: var(--wp--preset--color--text-primary); font-family: var(--wp--preset--font-family--raleway); font-size: var(--wp--preset--font-size--medium);\">array_any() &#8211; Check if any element matches a condition.<\/span><\/li>\n\n\n\n<li>array_all() &#8211; Verify that all elements match a condition.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">5 Implicit Nullable Types Deprecated<\/h2>\n\n\n\n<p>PHP now enforces explicit nullable types. Previously, a parameter defaulting to null was automatically considered nullable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Deprecated Syntax:\n\nfunction save(Book $book = null) {}\n\nCorrect Syntax:\n\nfunction save(?Book $book = null) {}<\/code><\/pre>\n\n\n\n<p>This change improves clarity and prepares PHP for stricter type handling in future versions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6 HTML5 Support with \\Dom\\HTMLDocument<\/h2>\n\n\n\n<p>PHP 8.4 introduces a new <strong>HTML5 parser <\/strong>with the \\Dom\\HTMLDocument class, providing better support for modern HTML5 content.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>$doc = \\Dom\\HTMLDocument::createFromString($contents);<\/code><\/pre>\n\n\n\n<p>The existing \\DOMDocument class remains for backward compatibility.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7 JIT Improvements and Configuration Changes<\/h2>\n\n\n\n<p>PHP 8.4 updates the <strong>JIT (Just-In-Time) compiler <\/strong>with cleaner configuration options:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>opcache.jit=disable\nopcache.jit_buffer_size=64m<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can now explicitly disable JIT with opcache.jit=disable.<\/li>\n\n\n\n<li>Performance and memory efficiency have also been improved.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">8 Lazy Objects: Efficient Proxy Initialization<\/h2>\n\n\n\n<p>PHP 8.4 adds <strong>lazy object support<\/strong>, a common feature in frameworks for creating proxy objects on demand.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$initializer = static function (MyClass $proxy): MyClass { return new MyClass(123);\n};<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>$reflector = new ReflectionClass(MyClass::class);\n$object = $reflector-&gt;newLazyProxy($initializer);<\/code><\/pre>\n\n\n\n<p>This improves efficiency when working with large objects that don\u2019t need immediate instantiation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">9 Exit and Die as Proper Functions<\/h2>\n\n\n\n<p>exit() and die() are now fully recognized as <strong>functions<\/strong>, supporting named arguments and strict types.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>exit(message: \"Goodbye\");<\/code><\/pre>\n\n\n\n<p>The old keyword syntax exit; continues to work as usual.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">10 Object API for BCMath<\/h2>\n\n\n\n<p>The <strong>BCMath extension <\/strong>now supports an object-oriented API with operator overloading, simplifying mathematical operations.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use BCMath\\Number;\n$num1 = new Number('2');\n$num2 = new Number('3');\n$result = $num1 + $num2;\necho $result-&gt;value; \/\/ Outputs \"5\"<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion:<\/strong><\/h2>\n\n\n\n<p>PHP 8.4 delivers powerful new features that streamline code, enhance performance, and simplify common tasks. From <strong>Property Hooks <\/strong>to the <strong>array_find <\/strong>utility and improved JIT configuration, developers have much to look forward to. Be sure to explore these changes and start preparing your code for the PHP 8.4 release!<\/p>\n\n\n\n<p>Stay tuned for further updates as PHP continues to evolve into a modern and robust programming language.<\/p>\n\n\n\n<details class=\"wp-block-details is-layout-flow wp-block-details-is-layout-flow\" open><summary>At <strong>200OK Solutions<\/strong>, we specialize in cutting-edge software development, tailored IT solutions, and expert technology consulting. As innovators in the tech industry, we stay ahead of trends, such as the latest advancements in PHP 8.4, to ensure our clients benefit from state-of-the-art tools and practices. Whether you&#8217;re a business seeking optimized web solutions or a developer looking for insights, 200OK Solutions is your trusted partner in growth and innovations.<\/summary><\/details>\n\n\n\n<p>Visit us at <a href=\"https:\/\/200oksolutions.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">200OK Solutions<\/a> to explore how we can elevate your technology strategy<a href=\"https:\/\/200oksolutions.com\/blog\"><\/a><\/p>\n\n\n<div class=\"is-default-size wp-block-site-logo\"><a href=\"https:\/\/www.200oksolutions.com\/blog\/\" class=\"custom-logo-link light-mode-logo\" rel=\"home\"><img fetchpriority=\"high\" decoding=\"async\" width=\"484\" height=\"191\" src=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/01\/cropped-200ok_logo.png\" class=\"custom-logo\" alt=\"Web Development, Software, and App Blog | 200OK Solutions\" srcset=\"https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/01\/cropped-200ok_logo.png 484w, https:\/\/www.200oksolutions.com\/blog\/wp-content\/uploads\/2026\/01\/cropped-200ok_logo-300x118.png 300w\" sizes=\"(max-width: 484px) 100vw, 484px\" \/><\/a><\/div>","protected":false},"excerpt":{"rendered":"<p>PHP 8.4, set to be released on November 21, 2024, brings an exciting wave of new features,&hellip;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[511,514,30,512,513],"class_list":["post-1622","post","type-post","status-publish","format-standard","hentry","category-php","tag-php-8-4","tag-php-8-4-improvements","tag-php-development","tag-php-features","tag-php-updates"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What&#039;s New in PHP 8.4: Key Features and Improvements Web Development, Software, and App Blog | 200OK Solutions<\/title>\n<meta name=\"description\" content=\"Discover PHP 8.4&#039;s new features, key updates, and improvements enhancing development performance, security, and efficiency.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What&#039;s New in PHP 8.4: Key Features and Improvements Web Development, Software, and App Blog | 200OK Solutions\" \/>\n<meta property=\"og:description\" content=\"Discover PHP 8.4&#039;s new features, key updates, and improvements enhancing development performance, security, and efficiency.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development, Software, and App Blog | 200OK Solutions\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-19T08:24:30+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-04T07:44:05+00:00\" \/>\n<meta name=\"author\" content=\"Piyush Solanki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Piyush Solanki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What's New in PHP 8.4: Key Features and Improvements Web Development, Software, and App Blog | 200OK Solutions","description":"Discover PHP 8.4's new features, key updates, and improvements enhancing development performance, security, and efficiency.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/","og_locale":"en_US","og_type":"article","og_title":"What's New in PHP 8.4: Key Features and Improvements Web Development, Software, and App Blog | 200OK Solutions","og_description":"Discover PHP 8.4's new features, key updates, and improvements enhancing development performance, security, and efficiency.","og_url":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/","og_site_name":"Web Development, Software, and App Blog | 200OK Solutions","article_published_time":"2024-12-19T08:24:30+00:00","article_modified_time":"2025-12-04T07:44:05+00:00","author":"Piyush Solanki","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Piyush Solanki","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/#article","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/"},"author":{"name":"Piyush Solanki","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e"},"headline":"What&#8217;s New in PHP 8.4: Key Features and Improvements","datePublished":"2024-12-19T08:24:30+00:00","dateModified":"2025-12-04T07:44:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/"},"wordCount":625,"commentCount":0,"publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"keywords":["PHP 8.4","PHP 8.4 improvements","PHP Development","PHP features","PHP updates"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/","url":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/","name":"What's New in PHP 8.4: Key Features and Improvements Web Development, Software, and App Blog | 200OK Solutions","isPartOf":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#website"},"datePublished":"2024-12-19T08:24:30+00:00","dateModified":"2025-12-04T07:44:05+00:00","description":"Discover PHP 8.4's new features, key updates, and improvements enhancing development performance, security, and efficiency.","breadcrumb":{"@id":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.200oksolutions.com\/blog\/whats-new-in-php-8-4-key-features-and-improvements\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.200oksolutions.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What&#8217;s New in PHP 8.4: Key Features and Improvements"}]},{"@type":"WebSite","@id":"https:\/\/www.200oksolutions.com\/blog\/#website","url":"https:\/\/www.200oksolutions.com\/blog\/","name":"Web Development, Software, and App Blog | 200OK Solutions","description":"","publisher":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.200oksolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.200oksolutions.com\/blog\/#organization","name":"Web Development Blog | Software Blog | App Blog","url":"https:\/\/www.200oksolutions.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","contentUrl":"https:\/\/200oksolutions.com\/blog\/wp-content\/uploads\/2025\/09\/200ok_logo-CGzMrWDu.png","width":500,"height":191,"caption":"Web Development Blog | Software Blog | App Blog"},"image":{"@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.instagram.com\/200ok_solutions\/"]},{"@type":"Person","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/e07f6b8e3c9a90ce7b3b09427d26155e","name":"Piyush Solanki","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.200oksolutions.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/962a2b0b4db856e6851ec7d838597a0395adcaae9c0091d223de9942a4254461?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/962a2b0b4db856e6851ec7d838597a0395adcaae9c0091d223de9942a4254461?s=96&d=mm&r=g","caption":"Piyush Solanki"},"description":"Piyush is a seasoned PHP Tech Lead with 10+ years of experience architecting and delivering scalable web and mobile backend solutions for global brands and fast-growing SMEs. He specializes in PHP, MySQL, CodeIgniter, WordPress, and custom API development, helping businesses modernize legacy systems and launch secure, high-performance digital products. He collaborates closely with mobile teams building Android &amp; iOS apps , developing RESTful APIs, cloud integrations, and secure payment systems using platforms like Stripe, AWS S3, and OTP\/SMS gateways. His work extends across CMS customization, microservices-ready backend architectures, and smooth product deployments across Linux and cloud-based environments. Piyush also has a strong understanding of modern front-end technologies such as React and TypeScript, enabling him to contribute to full-stack development workflows and advanced admin panels. With a successful delivery track record in the UK market and experience building digital products for sectors like finance, hospitality, retail, consulting, and food services, Piyush is passionate about helping SMEs scale technology teams, improve operational efficiency, and accelerate innovation through backend excellence and digital tools.","url":"https:\/\/www.200oksolutions.com\/blog\/author\/piyush\/"}]}},"_links":{"self":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=1622"}],"version-history":[{"count":7,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1622\/revisions"}],"predecessor-version":[{"id":1639,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1622\/revisions\/1639"}],"wp:attachment":[{"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.200oksolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}