{"id":3491,"date":"2022-08-31T08:31:05","date_gmt":"2022-08-31T08:31:05","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/php-8-2-whats-new\/"},"modified":"2026-04-28T14:07:04","modified_gmt":"2026-04-28T14:07:04","slug":"php-8-2-vad-ar-nytt","status":"publish","type":"post","link":"https:\/\/thecodest.co\/sv\/blog\/php-8-2-whats-new\/","title":{"rendered":"PHP 8.2: Vad \u00e4r nytt?"},"content":{"rendered":"\n<p><strong><a href=\"https:\/\/thecodest.co\/sv\/dictionary\/how-to-hire-a-php-developer\/\">PHP<\/a> 8.2<\/strong> is about to be released. Perhaps it will be the version that makes an upgrade into PHP 8 seem appealing to everyone. Let\u2019s talk about what developers can look forward to with <strong>PHP 8.2<\/strong> and prepare for its latest version. But first, let\u2019s quickly go through all the PHP versions and changes over the years.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Overview of past versions<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">PHP 7.4<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Typed properties<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\nclass User {\n    public int $id;\n    public string $name;\n}\n<strong>?&gt;<\/strong><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Arrow functions<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\n$factor = 10;\n$nums = array_map(fn($n) =&gt; $n * $factor, [1, 2, 3, 4]);\n\/\/ $nums = array(10, 20, 30, 40);\n<strong>?&gt;<\/strong><\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Limited return type covariance and argument type contravariance<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\nclass A {}\nclass B extends A {}\n\nclass Producer {\n    public function method(): A {}\n}\nclass ChildProducer extends Producer {\n    public function method(): B {}\n}\n<strong>?><\/strong><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Null coalescing assignment operator<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\n$array['key'] ??= computeDefault();\n\/\/ is roughly equivalent to\nif (!isset($array['key'])) {\n    $array['key'] = computeDefault();\n}\n<strong>?><\/strong><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Unpacking inside arrays<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\n$parts = ['apple', 'pear'];\n$fruits = ['banana', 'orange', ...$parts, 'watermelon'];\n\/\/ ['banana', 'orange', 'apple', 'pear', 'watermelon'];\n<strong>?><\/strong><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Custom object serialization<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\n\/\/ Returns array containing all the necessary state of the object.\npublic function __serialize(): array;\n\n\/\/ Restores the object state from the given <a href=\"https:\/\/thecodest.co\/sv\/blog\/app-data-collection-security-risks-value-and-types-explored\/\">data<\/a> array.\npublic function __unserialize(array $data): void;\n<strong>?><\/strong><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">PHP 8.0<\/h3>\n\n\n\n<p>Released in November 2020, PHP 8.0 brought <a href=\"https:\/\/thecodest.co\/sv\/blog\/why-us-companies-are-opting-for-polish-developers\/\">us<\/a> the best features yet, which includes:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Named arguments<\/h4>\n\n\n\n<pre title=\"\" class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">htmlspecialchars($string, double_encode: false);<code> <\/code><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Attributes<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class PostsController\n{\n    #[Route(\"\/api\/posts\/{id}\", methods: [\"GET\"])]\n    public function get($id) { \/* ... *\/ }\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Constructor property promotion<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Point {\n  public function __construct(\n    public float $x = 0.0,\n    public float $y = 0.0,\n    public float $z = 0.0,\n  ) {}\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Union types<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Number {\n  public function __construct(\n    private int|float $number\n  ) {}\n}\n\nnew Number('NaN'); \/\/ TypeError<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Match expression<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">echo match (8.0) {\n  '8.0' => \"Oh no!\",\n  8.0 => \"This is what I expected\",\n};\n\/\/> This is what I expected<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Nullsafe operator<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">$country = $session?->user?->getAddress()?->country;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">PHP 8.1<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Enumerations<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">enum Status\n{\n    case Draft;\n    case Published;\n    case Archived;\n}\nfunction acceptStatus(Status $status) {...}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Readonly Properties<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class BlogData\n{\n    public readonly Status $status;\n\n    public function __construct(Status $status)\n    {\n        $this->status = $status;\n    }\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">First-class Callable Syntax<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">$foo = $this->foo(...);\n\n$fn = strlen(...);<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">New in initializers<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class Service\n{\n    private Logger $logger;\n\n    public function __construct(\n        Logger $logger = new NullLogger(),\n    ) {\n        $this->logger = $logger;\n    }\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Pure Intersection Types<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function count_and_iterate(Iterator&amp;Countable $value) {\n    foreach ($value as $val) {\n        echo $val;\n    }\n\n    count($value);\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Fibers<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">$response = $httpClient->request('https:\/\/example.com\/');\nprint json_decode($response->getBody()->buffer())['code'];<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">PHP 8.2<\/h3>\n\n\n\n<p><strong>PHP 8.2<\/strong> introduces further changes aimed at making the developer&#8217;s life easier and optimizing his work even more. Below is the list of new features.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Readonly classes<\/h4>\n\n\n\n<p>One of the biggest improvements in the new version of PHP is the ability to directly create a <code>readonly<\/code> class. A class described with this feature will automatically propagate it for its variables. DTO classes will now look neat and clean!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">readonly class InvoiceDTO\n{\n    public function __construct(\n        public UUID $uuid,\n        public Issuer $issuer,\n        public DateTime $issuedAt,\n    ) {}\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Deprecate dynamic properties<\/h4>\n\n\n\n<p>The second huge change is the deprecation of dynamic variables in classes. The following implementation will throw a deprecation in <strong>PHP 8.2<\/strong> and <code>ErrorException<\/code> in future version of PHP.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">class MyUser\n{\n    public string $name;\n}\n(...)\n$myUser-&gt;name = 'Name'; \/\/ OK\n$myUser-&gt;surname = 'Surname'; \/\/ deprecated \/ errorexception<\/code><\/pre>\n\n\n\n<p>It is worth mentioning that classes implementing <code>__get<\/code> and <code>__set<\/code> methods and classes directly inheriting from <code>stdClass<\/code> can still implement magic methods without any obstacles.<\/p>\n\n\n\n<p>Here I also refer you to an <a href=\"https:\/\/github.com\/squizlabs\/PHP_CodeSniffer\/issues\/3489\" rel=\"nofollow\">interesting thread on GitHub<\/a>, where PHP-CS developers discuss this change and the need to modify their popular tool for the new version of the language.<\/p>\n\n\n\n<p>Last but not least, you can disable this behavior via Annotation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">#[AllowDynamicProperties]\nclass MyUser\n{\n    public string $name;\n}\n\n$myUser->surname = 'Surname'; \/\/ OK<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">New standalone types: <code>null<\/code>, <code>true<\/code>, and <code>false<\/code><\/h4>\n\n\n\n<p>Until now, functions that always returned a <code>true<\/code> or <code>false<\/code> value had to be described with a <code>bool<\/code> type.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function alwaysTrue(): bool { return true; }<\/code><\/pre>\n\n\n\n<p>From now on, we can use <code>true<\/code> and <code>false<\/code> as simple types in the returned values of functions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function alwaysTrue(): true { return true; }<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Disjunctive Normal Form Types<\/h4>\n\n\n\n<p>(DNF) is a standard way of organizing boolean expressions. Specifically, it means structuring a boolean expression into an ORed series of ANDs. When applied to type declarations, it allows for a standard way to write combined Union and Intersection types that the parser can handle.<\/p>\n\n\n\n<p>It&#8217;s a big change, as we now can have nullable intersection types, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function getFullName((HasName&amp;HasSurname)|null $user) { ... }<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Constants in Traits<\/h4>\n\n\n\n<p>I&#8217;m not a big proponent of using Traits and such a change is purely cosmetic to me, especially since it doesn&#8217;t allow you to use Trait values without initializing the object.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">trait Foo {\n    public const FLAG_1 = 1;\n    protected const FLAG_2 = 2;\n    private const FLAG_3 = 2;\n\n    public function doFoo(int $flags): void {\n        if ($flags &amp; self::FLAG_1) {\n            echo 'Got flag 1';\n        }\n        if ($flags &amp; self::FLAG_2) {\n            echo 'Got flag 2';\n        }\n        if ($flags &amp; self::FLAG_3) {\n            echo 'Got flag 3';\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Redacting parameters in back traces<\/h4>\n\n\n\n<p>One of the most important changes I am looking forward to. In the latest version of PHP we will be able to mark variables as <code>SensitiveParameterValue<\/code>. Why should we?<\/p>\n\n\n\n<p>PHP&#8217;s stack traces in exceptions are very useful for debugging, however, they allow you to preview parameter values. For example, let&#8217;s imagine PDO <a href=\"https:\/\/thecodest.co\/sv\/dictionary\/what-is-code-refactoring\/\">code<\/a> used to connect to a database. The debug trace would look as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">PDOException: SQLSTATE[HY000] [2002] No such file or directory in \/var\/www\/html\/test.php:3\nStack trace:\n#0 \/var\/www\/html\/test.php(3): PDO->__construct('<a href=\"https:\/\/thecodest.co\/sv\/blog\/fintech-app-development-services-features-in-2026\/\">mysql<\/a>:host=loca...', 'root', 'password')\n#1 {main}<\/code><\/pre>\n\n\n\n<p>After using Annotation <code>#[SensitiveParameter]<\/code> our stack trace will no longer show the value of the variable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">function test(\n    $foo,\n    #[SensitiveParameter] $bar,\n    $baz\n) {\n    throw new Exception('Error');\n}\n\ntest('foo', 'bar', 'baz');\n\n\/*\nFatal error: Uncaught Exception: Error in test.php:8\nStack trace:\n#0 test.php(11): test('foo', Object(SensitiveParameterValue), 'baz')\n#1 {main}\n  thrown in test.php on line 8\n*\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Fetch properties of enums in const expressions<\/h3>\n\n\n\n<p>As <a href=\"https:\/\/wiki.php.net\/rfc\/fetch_property_in_const_expressions\" rel=\"nofollow\">author says<\/a><br>, the primary motivation for this change is to allow fetching the name and value properties in places where enum objects aren&#8217;t allowed, like array keys. We could work on arrays so they could be extended to allow enums or all objects as keys, but allowing to fetch properties of enums is simpler.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">enum A: string {\n    case B = 'B';\n    const C = [self::B->value => self::B];\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Date functions return types<\/h3>\n\n\n\n<p>Previously static methods worked like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">DateTime::createFromImmutable(): DateTime\nDateTimeImmutable::createFromMutable(): DateTimeImmutable<span style=\"background-color: initial; font-family: inherit; font-size: inherit;\"> <\/span><\/code><\/pre>\n\n\n\n<p>In <strong>PHP 8.2 <\/strong> it&#8217;s going to be changed to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">DateTime::createFromImmutable(): static\nDateTimeImmutable::createFromMutable(): static<\/code><\/pre>\n\n\n\n<p>This is a breaking change for library creators and\/or all custom implementations of DateTime.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deprecate and Remove `utf8_encode` and `utf8_decode`<\/h3>\n\n\n\n<p>Those were two function that did not served it purpose, as they only converted between <code>ISO-8859-1<\/code> and <code>UTF-8<\/code>. PHP Manual suggest using <code>mb_convert_encoding<\/code> instead.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Locale-independent case conversion<\/h3>\n\n\n\n<p>Locale sensitivity is best described by author of the RFC:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Prior to PHP 8.0, PHP&#8217;s locale was set from the environment. When a user installs Linux, it asks what language you want it to be in. The user might not fully appreciate the consequences of this decision. It not only sets the user interface language for built-in commands, it also pervasively changes how string handling in the C library works. For example, a user selecting \u201cTurkish\u201d when installing Linux would find that applications calling toupper(&#8216;i&#8217;) would obtain the dotted capital I (U+0130, \u201c\u0130\u201d).<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>In an era of standardized text-based protocols, natural language is a minority application for case conversion. But even if the user did want natural language case conversion, they would be unlikely to achieve success with strtolower(). This is because it processes the string one byte at a time, feeding each byte to the C library&#8217;s tolower(). If the input is UTF-8, by far the most popular modern choice, strtolower() will mangle the string, typically producing invalid UTF-8 as output.<\/p>\n<\/blockquote>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>PHP 8.0 stopped respecting the locale environment variables. So the locale is always \u201cC\u201d unless the user explicitly calls setlocale(). This means that the bulk of the backwards-incompatible change is already behind us. Any applications depending on the system locale to do case conversion of legacy 8-bit character sets would have been broken by PHP 8.0.<\/p>\n<\/blockquote>\n\n\n\n<p>What it means is that all of below function will do ASCII case conversion from PHP.8.2:<br><code>strtolower<\/code>, <code>strtoupper<\/code>, <code>stristr<\/code>, <code>stripos<\/code>, <code>strripos<\/code>, <code>lcfirst<\/code>, <code>ucfirst<\/code>, <code>ucwords<\/code>, <code>str_ireplace<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Deprecate ${} string interpolation<\/h3>\n\n\n\n<p>We&#8217;ve got a lot of ways of embedding variables into strings in PHP:<br>&#8211; Directly embedding variables (\u201c$foo\u201d)<br>&#8211; Braces outside the variable (\u201c{$foo}\u201d)<br>&#8211; Braces after the dollar sign (\u201c${foo}\u201d)<br>&#8211; Variable variables (\u201c${expr}\u201d, equivalent to (string) ${expr})<\/p>\n\n\n\n<p>To avoid confusion and misuse those will not work anymore:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">\"Hello ${world}\";\nDeprecated: Using ${} in strings is deprecated\n\n\"Hello ${(world)}\";\nDeprecated: Using ${} (variable variables) in strings is deprecated<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>These are not all the changes that <strong>PHP 8.2 <\/strong> will offer us. Unfortunately, we still didn&#8217;t get support for generic types, according to what Nikita said the monomorphized generics would add too much performance overhead, and reified generics require many changes across the whole codebase. What is noticeable, however, is the discipline and vision of the <a href=\"https:\/\/thecodest.co\/sv\/dictionary\/how-to-make-product\/\">product<\/a>. The changes introduced in successive versions of the language are becoming clearer, and those interested will notice that <strong>PHP <\/strong> is moving in the right direction both in the area of syntax simplification and support for novelties. I expect that as early as next year we will see <code>callable<\/code> as a valid type.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/contact\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/interested_in_cooperation_.png\" alt=\"cooperation banner\"\/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Den nya versionen av PHP \u00e4r precis runt h\u00f6rnet. Vilka \u00e4r de nya implementeringar som du b\u00f6r k\u00e4nna till? Kolla in den h\u00e4r artikeln f\u00f6r att ta reda p\u00e5 det!<\/p>","protected":false},"author":2,"featured_media":3492,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3491","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>PHP 8.2: What&#039;s new? - The Codest<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/sv\/blogg\/php-8-2-vad-ar-nytt\/\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP 8.2: What&#039;s new?\" \/>\n<meta property=\"og:description\" content=\"The new version of PHP is just around the corner. What are the new implementations you should know about? Check this article to find out!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/sv\/blogg\/php-8-2-vad-ar-nytt\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-31T08:31:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-28T14:07:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/php_8.2__what_s_new_.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minuter\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"PHP 8.2: What&#8217;s new?\",\"datePublished\":\"2022-08-31T08:31:05+00:00\",\"dateModified\":\"2026-04-28T14:07:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/\"},\"wordCount\":1046,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/php_8.2__what_s_new_.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/\",\"name\":\"PHP 8.2: What's new? - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/php_8.2__what_s_new_.png\",\"datePublished\":\"2022-08-31T08:31:05+00:00\",\"dateModified\":\"2026-04-28T14:07:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#breadcrumb\"},\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/php_8.2__what_s_new_.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/php_8.2__what_s_new_.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/php-8-2-whats-new\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP 8.2: What&#8217;s new?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"sv-SE\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/sv\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PHP 8.2: Vad \u00e4r nytt? - The Codest","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:\/\/thecodest.co\/sv\/blogg\/php-8-2-vad-ar-nytt\/","og_locale":"sv_SE","og_type":"article","og_title":"PHP 8.2: What's new?","og_description":"The new version of PHP is just around the corner. What are the new implementations you should know about? Check this article to find out!","og_url":"https:\/\/thecodest.co\/sv\/blogg\/php-8-2-vad-ar-nytt\/","og_site_name":"The Codest","article_published_time":"2022-08-31T08:31:05+00:00","article_modified_time":"2026-04-28T14:07:04+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/php_8.2__what_s_new_.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"4 minuter"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"PHP 8.2: What&#8217;s new?","datePublished":"2022-08-31T08:31:05+00:00","dateModified":"2026-04-28T14:07:04+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/"},"wordCount":1046,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/php_8.2__what_s_new_.png","articleSection":["Software Development"],"inLanguage":"sv-SE","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/","url":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/","name":"PHP 8.2: Vad \u00e4r nytt? - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/php_8.2__what_s_new_.png","datePublished":"2022-08-31T08:31:05+00:00","dateModified":"2026-04-28T14:07:04+00:00","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/"]}]},{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/php_8.2__what_s_new_.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/php_8.2__what_s_new_.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/php-8-2-whats-new\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"PHP 8.2: What&#8217;s new?"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"sv-SE"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/sv\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/comments?post=3491"}],"version-history":[{"count":20,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3491\/revisions"}],"predecessor-version":[{"id":7945,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3491\/revisions\/7945"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/media\/3492"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/media?parent=3491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/categories?post=3491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/tags?post=3491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}