{"id":2533,"date":"2022-12-18T18:11:04","date_gmt":"2022-12-18T21:11:04","guid":{"rendered":"https:\/\/felipeelia.com.br\/?p=2533"},"modified":"2022-12-18T18:11:07","modified_gmt":"2022-12-18T21:11:07","slug":"will-php-7-2-be-the-minimum-required-version-for-wp-6-2","status":"publish","type":"post","link":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/","title":{"rendered":"Will PHP 7.2 be the minimum required version for WP 6.2?"},"content":{"rendered":"\n

Yes, this is real! It seems that starting from WordPress 6.2 the minimum PHP version required by WP will be 7.2<\/strong>. The last change in that aspect of the software was made in May 2019, for WordPress 5.2. <\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n

The update did not happen before because the team set 5% as the maximum threshold of version usage. According to this ticket<\/a>, PHP 5.6 usage finally dropped below that. As PHP doesn’t have version 6 and versions 7.0 and 7.1 have usage numbers even lower, the minimum version would be bumped to PHP 7.2. The numbers are also available on the Stats page of WP.org<\/a>.<\/p>\n\n\n\n

\n

As of 17 Dec 2022 […]:

PHP 5.6 is at 4.99% of all WordPress sites
PHP 7.0 is at 2.68%
PHP 7.1 is at 1.82%<\/p>\n
https:\/\/core.trac.wordpress.org\/ticket\/57345<\/a><\/cite><\/blockquote>\n\n\n\n

WordPress and PHP’s timeline<\/h2>\n\n\n\n

To increase backward compatibility, WordPress adopts a strict policy regarding minimum PHP versions. PHP 5.2, for example, had its final version released in January 2011 but it was supported by WP until 2019.<\/p>\n\n\n\n

PHP 5.6 reached its end of life<\/a> in December 2018 and today, 4 years later, it is still the minimum required version by WordPress. If the change really happens, we will be still behind: PHP 7.2 saw its last version released in November 2020<\/strong>, two years ago.<\/p>\n\n\n\n

Out of curiosity, while I write this post, the oldest version still receiving updates<\/a> is PHP 8.0, with end-of-life planned for November 2023. The latest version, 8.2, was released this month and will receive security updates until December 2025.<\/p>\n\n\n\n

<\/th>PHP End Of Life<\/th>End of Support By WP<\/th><\/tr><\/thead>
PHP 5.2<\/td>01\/2011<\/td>05\/2019 (WP 5.2)<\/td><\/tr>
PHP 5.6<\/td>12\/2018<\/td>??\/2023 (WP 6.2)<\/td><\/tr>
PHP 7.2<\/td>11\/2020<\/td><\/td><\/tr>
PHP 8.0 (current version)<\/td>11\/2023<\/td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

What the PHP version changes for WordPress<\/h2>\n\n\n\n

Beyond improvements in security and speed<\/strong>, changing the PHP version also makes available a set of new features, modernizing the codebase and decreasing the chances of bugs.<\/p>\n\n\n\n

You can see the full list of features that would be available in these three links: PHP 7.0<\/a>, PHP 7.1<\/a>, and PHP 7.2<\/a>. Below you can see just some examples<\/strong> of what we would get just setting PHP 7.0 as the minimum:<\/p>\n\n\n\n

Return type declarations<\/h3>\n\n\n\n

Since PHP 7.0 it is possible to declare the type returned by a function or method:<\/p>\n\n\n\n

function example( array ...$arrays ): array {}<\/code><\/pre>\n\n\n\n

Although it is common in some other languages, type declarations (for parameters and return) can be something new to some.<\/p>\n\n\n\n

The biggest advantage of this feature is static analysis of code<\/strong>: even without executing the code, it is possible to identify if example()<\/code> is being called without expecting an array<\/em>. If that is the case, the error can be detected and fixed before any other test is executed.<\/p>\n\n\n\n

The majority of IDEs already have that function built in nowadays.<\/p>\n\n\n\n

Null coalescing operator (??)<\/h3>\n\n\n\n

Instead of writing<\/p>\n\n\n\n

$username = isset( $_GET['user'] ) ? $_GET['user'] : 'nobody';<\/code><\/pre>\n\n\n\n

it would be possible to write its simplified version:<\/p>\n\n\n\n

$username = $_GET['user'] ?? 'nobody';<\/code><\/pre>\n\n\n\n

Spaceship operator (<=>)<\/h3>\n\n\n\n

Commonly used for comparison functions, this operator returns -1, 0, or 1 depending on the comparison result.<\/p>\n\n\n\n

echo 1 <=> 1; \/\/ 0\necho 1 <=> 2; \/\/ -1\necho 2 <=> 1; \/\/ 1<\/code><\/pre>\n\n\n\n

PHP 8 Compatibility and WordPress Versions<\/h2>\n\n\n\n

Keeping compatibility with a so wide range of versions makes things harder. Compatibility with PHP 8 (8.0, 8.1, and 8.2) is still in Beta<\/a>. Will dropping support to PHP 5.6 give enough room to focus on PHP 8.x? Let’s hope so!<\/p>\n\n\n\n

And you, did you already update your PHP site version?<\/p>\n","protected":false},"excerpt":{"rendered":"

Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[89,148,91],"tags":[],"yoast_head":"\nWill PHP 7.2 be the minimum required version for WP 6.2? | Felipe Elia<\/title>\n<meta name=\"description\" content=\"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Will PHP 7.2 be the minimum required version for WP 6.2? | Felipe Elia\" \/>\n<meta property=\"og:description\" content=\"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Felipe Elia\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/felipe.elia\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/felipe.elia\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-18T21:11:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-18T21:11:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/felipeelia.com.br\/wp-content\/uploads\/2022\/12\/meme-gatsy.jpg\" \/>\n<meta name=\"author\" content=\"Felipe Elia\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/felipe_elia\" \/>\n<meta name=\"twitter:site\" content=\"@felipe_elia\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Felipe Elia\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\"},\"author\":{\"name\":\"Felipe Elia\",\"@id\":\"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292\"},\"headline\":\"Will PHP 7.2 be the minimum required version for WP 6.2?\",\"datePublished\":\"2022-12-18T21:11:04+00:00\",\"dateModified\":\"2022-12-18T21:11:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\"},\"wordCount\":504,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292\"},\"articleSection\":[\"News\",\"PHP\",\"WordPress\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\",\"url\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\",\"name\":\"Will PHP 7.2 be the minimum required version for WP 6.2? | Felipe Elia\",\"isPartOf\":{\"@id\":\"https:\/\/felipeelia.com.br\/#website\"},\"datePublished\":\"2022-12-18T21:11:04+00:00\",\"dateModified\":\"2022-12-18T21:11:07+00:00\",\"description\":\"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?\",\"breadcrumb\":{\"@id\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/felipeelia.dev\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Will PHP 7.2 be the minimum required version for WP 6.2?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/felipeelia.com.br\/#website\",\"url\":\"https:\/\/felipeelia.com.br\/\",\"name\":\"Felipe Elia\",\"description\":\"Programa\u00e7\u00e3o com WordPress de um jeito f\u00e1cil, do b\u00e1sico ao avan\u00e7ado\",\"publisher\":{\"@id\":\"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/felipeelia.com.br\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292\",\"name\":\"Felipe Elia\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/felipeelia.com.br\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/felipeelia.dev\/wp-content\/uploads\/2023\/06\/avatar-400x400-1.jpg\",\"contentUrl\":\"https:\/\/felipeelia.dev\/wp-content\/uploads\/2023\/06\/avatar-400x400-1.jpg\",\"width\":400,\"height\":400,\"caption\":\"Felipe Elia\"},\"logo\":{\"@id\":\"https:\/\/felipeelia.com.br\/#\/schema\/person\/image\/\"},\"description\":\"Associate Director of Platform Engineering na 10up, WordPress Core Contributor, Global Polyglots Mentor na comunidade internacional do WordPress e Locale Manager na comunidade WordPress Brasil.\",\"sameAs\":[\"https:\/\/www.facebook.com\/felipe.elia\",\"https:\/\/www.instagram.com\/felipe.elia\/\",\"https:\/\/www.linkedin.com\/in\/felipeelia\/\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/felipe_elia\",\"https:\/\/www.youtube.com\/channel\/UCD_26rOE3ClALcZreTkyIoQ\"],\"url\":\"https:\/\/felipeelia.com.br\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Will PHP 7.2 be the minimum required version for WP 6.2? | Felipe Elia","description":"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?","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:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/","og_locale":"pt_BR","og_type":"article","og_title":"Will PHP 7.2 be the minimum required version for WP 6.2? | Felipe Elia","og_description":"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?","og_url":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/","og_site_name":"Felipe Elia","article_publisher":"https:\/\/www.facebook.com\/felipe.elia","article_author":"https:\/\/www.facebook.com\/felipe.elia","article_published_time":"2022-12-18T21:11:04+00:00","article_modified_time":"2022-12-18T21:11:07+00:00","og_image":[{"url":"https:\/\/felipeelia.com.br\/wp-content\/uploads\/2022\/12\/meme-gatsy.jpg"}],"author":"Felipe Elia","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/felipe_elia","twitter_site":"@felipe_elia","twitter_misc":{"Escrito por":"Felipe Elia","Est. tempo de leitura":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#article","isPartOf":{"@id":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/"},"author":{"name":"Felipe Elia","@id":"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292"},"headline":"Will PHP 7.2 be the minimum required version for WP 6.2?","datePublished":"2022-12-18T21:11:04+00:00","dateModified":"2022-12-18T21:11:07+00:00","mainEntityOfPage":{"@id":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/"},"wordCount":504,"commentCount":0,"publisher":{"@id":"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292"},"articleSection":["News","PHP","WordPress"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/","url":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/","name":"Will PHP 7.2 be the minimum required version for WP 6.2? | Felipe Elia","isPartOf":{"@id":"https:\/\/felipeelia.com.br\/#website"},"datePublished":"2022-12-18T21:11:04+00:00","dateModified":"2022-12-18T21:11:07+00:00","description":"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?","breadcrumb":{"@id":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/felipeelia.dev\/will-php-7-2-be-the-minimum-required-version-for-wp-6-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/felipeelia.dev\/"},{"@type":"ListItem","position":2,"name":"Will PHP 7.2 be the minimum required version for WP 6.2?"}]},{"@type":"WebSite","@id":"https:\/\/felipeelia.com.br\/#website","url":"https:\/\/felipeelia.com.br\/","name":"Felipe Elia","description":"Programa\u00e7\u00e3o com WordPress de um jeito f\u00e1cil, do b\u00e1sico ao avan\u00e7ado","publisher":{"@id":"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/felipeelia.com.br\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":["Person","Organization"],"@id":"https:\/\/felipeelia.com.br\/#\/schema\/person\/927a99b6e1cde7fcf9f4f79a1638b292","name":"Felipe Elia","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/felipeelia.com.br\/#\/schema\/person\/image\/","url":"https:\/\/felipeelia.dev\/wp-content\/uploads\/2023\/06\/avatar-400x400-1.jpg","contentUrl":"https:\/\/felipeelia.dev\/wp-content\/uploads\/2023\/06\/avatar-400x400-1.jpg","width":400,"height":400,"caption":"Felipe Elia"},"logo":{"@id":"https:\/\/felipeelia.com.br\/#\/schema\/person\/image\/"},"description":"Associate Director of Platform Engineering na 10up, WordPress Core Contributor, Global Polyglots Mentor na comunidade internacional do WordPress e Locale Manager na comunidade WordPress Brasil.","sameAs":["https:\/\/www.facebook.com\/felipe.elia","https:\/\/www.instagram.com\/felipe.elia\/","https:\/\/www.linkedin.com\/in\/felipeelia\/","https:\/\/twitter.com\/https:\/\/twitter.com\/felipe_elia","https:\/\/www.youtube.com\/channel\/UCD_26rOE3ClALcZreTkyIoQ"],"url":"https:\/\/felipeelia.com.br\/author\/admin\/"}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"ocean-thumb-m":false,"ocean-thumb-ml":false,"ocean-thumb-l":false,"yarpp-thumbnail":false},"uagb_author_info":{"display_name":"Felipe Elia","author_link":"https:\/\/felipeelia.com.br\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Will WP 6.2 finally update the minimum required PHP version to 7.2? Why does it matter?","_links":{"self":[{"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/posts\/2533"}],"collection":[{"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/comments?post=2533"}],"version-history":[{"count":0,"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/posts\/2533\/revisions"}],"wp:attachment":[{"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/media?parent=2533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/categories?post=2533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/felipeelia.dev\/wp-json\/wp\/v2\/tags?post=2533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}