{"id":914,"date":"2019-05-24T08:52:20","date_gmt":"2019-05-24T08:52:20","guid":{"rendered":"http:\/\/smohub.com\/blog\/?p=914"},"modified":"2019-05-24T08:54:05","modified_gmt":"2019-05-24T08:54:05","slug":"new-features-php7-for-wordpress-developers","status":"publish","type":"post","link":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/","title":{"rendered":"New features PHP7  for WordPress Developers"},"content":{"rendered":"<div class=\"spacing\">\n<p>PHP has changed a lot in the last few years. And even before that, it had changed a lot. In short, modern PHP is a great and cool language, with only a few of the worst problems that people who last used it a decade age will remember. (Modern) PHP 7 and WordPress haven\u2019t really gone together historically.<\/p>\n<p>But the gap between the PHP we\u2019ve always had (to encourage you to write) for WordPress and modern PHP is big. In this article I\u2019ll blaze through the highlight features that\u2019ll make developing for WordPress in a PHP 7 world great. Surely most of the techniques that one used for being a good PHP+WordPress developer for while are still good to know. But surely some of them are due for an upgrade this year.<\/p>\n<h2>What I mean by \u201cmodern PHP,\u201d and how it differs from WordPress<\/h2>\n<p>As I write this, PHP 7.3 is the \u201cmodern\u201d version. And WordPress PHP for a while has maintained compatibility with PHP 5.2. While the number of versions between 5.2 and 7.3 may be fewer than a WordPress developer would guess (i.e, it wasn\u2019t the approximately 20 it kind of looks like), it is a lot. And a lot changed. So here we\u2019re going to be confined to strict summaries of core features that are interesting and better since PHP 5.2. Please, if I forgot your favorite leave me a comment.<\/p>\n<h2>Syntactical Niceties: PHP has Short Array Syntax! Etc<\/h2>\n<p>This will just be a sequence of small changes in your syntax that PHP 7 WordPress code will allow. Where I can recall, I\u2019ll give a bit of history and bit of summary. But as I said this is a lot of ground that comes from WordPress PHP 7 compatibility, so I\u2019ll move quick and just touch on all the topics.<\/p>\n<h3>PHP SHORT ARRAY SYNTAX<\/h3>\n<p>This one\u2019s quick: in PHP 5.4, we got full-fledged support for shorter array syntax. Be gone, function-looking array declarations. And welcome your square brackets. So\u00a0<code>array(1)<\/code>\u00a0is really just\u00a0<code>[1]<\/code>. What\u2019s not to like? In other words, we have this available always and everywhere:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token variable\">$args<\/span> <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">'posts_per_page'<\/span> <span class=\"token operator\">=&gt;<\/span> <span class=\"token number\">7<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span>\r\n<\/code><\/pre>\n<p>Pretty cool.<\/p>\n<h3>NULL-COALESCE OPERATOR<\/h3>\n<p>This ones a little more nerdy and complex. Because we\u2019re in a hurry, we\u2019ll assume you have some familiarity with ternary operators.\u00a0I wrote an article about them if you\u2019re not familiar.<\/p>\n<p>Now, what does this do? What it does is let us bypass a necessary\u00a0<code>isset<\/code>\u00a0call in legacy PHP. So historically PHP would error if you assumed a value (most often in an array) existed and it didn\u2019t. Now using the\u00a0<code>??<\/code>\u00a0operator, you don\u2019t have to worry. Code sample:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token variable\">$x<\/span> <span class=\"token operator\">=<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">\"yarr\"<\/span> <span class=\"token operator\">=&gt;<\/span> <span class=\"token string\">\"meaningful_value\"<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token function\">var_dump<span class=\"token punctuation\">(<\/span><\/span><span class=\"token variable\">$x<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">\"aharr\"<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">?<\/span><span class=\"token operator\">?<\/span> <span class=\"token variable\">$x<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">\"waharr\"<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">?<\/span><span class=\"token operator\">?<\/span> <span class=\"token variable\">$x<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">\"yarr\"<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><span class=\"token comment\" spellcheck=\"true\"> \/\/ string(16) \"meaningful_value\"\r\n<\/span><\/code><\/pre>\n<h3>SPACESHIP OPERATOR<\/h3>\n<p>This one mostly I mention because it\u2019s got a fun name. What\u2019s PHP\u2019s spaceship operator? It\u2019s this:\u00a0<code>&lt;=&gt;<\/code>. This is really a shorthand functionality that\u2019s useful in just a small number of cases, but for things like\u00a0<code>usort<\/code>, you used to have to make longer expression often with a ternary operator. Now you can do simpler things. Relevant sample code:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token comment\" spellcheck=\"true\">\/\/ Sort $things by 'foo' property, ascending\r\n<\/span><span class=\"token function\">usort<span class=\"token punctuation\">(<\/span><\/span><span class=\"token variable\">$things<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">function<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token variable\">$a<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token variable\">$b<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n    <span class=\"token keyword\">return<\/span> <span class=\"token variable\">$a<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">'foo'<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&lt;<\/span><span class=\"token operator\">=&gt;<\/span> <span class=\"token variable\">$b<\/span><span class=\"token punctuation\">[<\/span><span class=\"token string\">'foo'<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<\/code><\/pre>\n<h2>OOP-ish Niceties You Should Consider (from PHP 5.x)<\/h2>\n<p>WordPress itself, and WordPress development generally, isn\u2019t super object-oriented. There are objects around, but I\u2019d say more than half of the WordPress code I regularly see isn\u2019t object-oriented. Most of these features will only make sense if you\u2019re a little familiar with OOP. If you\u2019re not, we\u2019ve got\u00a0a great free course to help you come up to speed on OOPHP<\/p>\n<h3>PHP NAMESPACES ARE USEFUL!<\/h3>\n<p>This one I\u2019ve written up\u00a0at length here at Thoughtful Code. So I\u2019ll keep this one short and sweet. Namespaces let us keep like things together through a method other than shoving them into an object. We have \u201cvirtual folders\u201d called \u201cnamespaces\u201d, so that I may have something like\u00a0<code>RequireFeaturedImage\\Utility<\/code>\u00a0as a place that I then throw a couple different classes or functions. It\u2019s pretty powerful.<\/p>\n<p>If you want to understand PHP namespaces in more depth, I already wrote that:<\/p>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" title=\"\u201cA Complete Guide to PHP Namespaces\u201d \u2014 Thoughtful Code\" src=\"https:\/\/www.thoughtfulcode.com\/a-complete-guide-to-php-namespaces\/embed\/#?secret=LhFqM1bL7n\" width=\"500\" height=\"257\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" sandbox=\"allow-scripts\" data-secret=\"LhFqM1bL7n\" data-mce-fragment=\"1\"><\/iframe><\/p>\n<h3>COMPOSER COMES FROM PHP NAMESPACES! AND CAN CHANGE YOUR LIFE!<\/h3>\n<p>So this is a rabbit-hole far too deep to explain in depth right now. But\u00a0Composer (which really needs PHP namespaces to work well) is the dependency manager that PHP has needed for about about 10 years, and has had for about 5. But Composer and WordPress haven\u2019t been great friends, in part because WordPress has focused on PHP 5.2 compatibility, which Composer could never do.<\/p>\n<p>If you\u2019re still not understanding this, some analogies that may help you. Composer is like\u00a0<code>npm<\/code>\u00a0in the JavaScript ecosystem, Ruby\u2019s\u00a0<code>gem<\/code>s, or you phone or computer\u2019s App Store. And it\u2019s totally free! It\u2019s certainly something you must at least vaguely understand to be a modern PHP developer for WordPress.<\/p>\n<h3>PHP TRAITS ARE GREAT<\/h3>\n<p>Traits are, essentially, small bits of functionality you can \u201cmixin\u201d to a class. I chose to focus on them over other common PHP features that PHP got since 5.2 (like interfaces, etc) that WordPress developers haven\u2019t used as they\u2019re kind of novel.<\/p>\n<p>I have mixed feelings about traits, which are a useful way to modularize code, but also a great way to confuse the next developer who missed your little\u00a0<code>use<\/code>\u00a0statement inside of a class definition. On the whole though, they\u2019re a very useful tool to understand.<\/p>\n<p>A code sample doesn\u2019t quite do it justice. But here\u2019s the briefest one that might make sense:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token keyword\">trait<\/span> <span class=\"token class-name\">SayHelloWorld<\/span> <span class=\"token punctuation\">{<\/span>\r\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">function<\/span> <span class=\"token function\">sayHello<span class=\"token punctuation\">(<\/span><\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n        <span class=\"token keyword\">echo<\/span> <span class=\"token string\">'Hello World!'<\/span><span class=\"token punctuation\">;<\/span>\r\n    <span class=\"token punctuation\">}<\/span>\r\n<span class=\"token punctuation\">}<\/span>\r\n\r\n<span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MyHelloWorld<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">Base<\/span> <span class=\"token punctuation\">{<\/span>\r\n    <span class=\"token keyword\">use<\/span> <span class=\"token package\">SayHelloWorld<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token punctuation\">}<\/span>\r\n<span class=\"token variable\">$hello<\/span> <span class=\"token operator\">=<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">MyHelloWorld<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token variable\">$hello<\/span><span class=\"token operator\">-<\/span><span class=\"token operator\">&gt;<\/span><span class=\"token function\">sayHello<span class=\"token punctuation\">(<\/span><\/span><span class=\"token punctuation\">)<\/span><span class=\"token comment\" spellcheck=\"true\"> \/\/ 'Hello World!'\r\n<\/span><\/code><\/pre>\n<p>The core this to notice about code sample\u00a0<code>MyHelloWorld<\/code>\u00a0never had the method\u00a0<code>sayHello<\/code>in its declaration. It got it from using the\u00a0<code>SayHelloWorld<\/code>\u00a0trait.<\/p>\n<h3>GET FULL NAMES WITH ::CLASS EASILY<\/h3>\n<p>In PHP 5.5, it became possible to use\u00a0<code>ClassName::class<\/code>\u00a0to get a fully qualified name of class ClassName. That is,\u00a0<code>ClassName::class<\/code>, will give me\u00a0<code>'\\App\\Utilities\\Classname'<\/code>which can be invoked elsewhere in my code, or loaded up in some other way. This is mostly useful and necessary because of namespaces. This is such a simple little trick, but I use it\u00a0<em>all the time<\/em>, so I just had to mention it.<\/p>\n<h3>ANONYMOUS FUNCTIONS ARE GREAT FOR QUICK WORDPRESS HOOKS<\/h3>\n<p>This one isn\u2019t very OOP, but for years I\u2019ve been explaining WordPress hooks with function names. But for nearly a decade, you\u2019ve been able to use anonymous functions in PHP and WordPress. But with support for 5.2 (which didn\u2019t support it) finally going away, you\u2019ll be able to do this in places for quick and convenient hooking. (There are still lots of reasons not to, but that\u2019s a whole other discussion):<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token function\">add_action<span class=\"token punctuation\">(<\/span><\/span><span class=\"token string\">'init'<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">function<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span>\r\n    <span class=\"token keyword\">echo<\/span> <span class=\"token string\">'WPShout was here with an anonymous function.'<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3>RETURN TYPE DECLARATIONS<\/h3>\n<p>In PHP 7 and above, you\u2019ll sometimes see a pretty weird function signature:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token keyword\">function<\/span> <span class=\"token function\">foo<span class=\"token punctuation\">(<\/span><\/span><span class=\"token variable\">$time_string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span> DateTime <span class=\"token punctuation\">{<\/span> \r\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">DateTime<\/span><span class=\"token punctuation\">(<\/span><span class=\"token variable\">$time_string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token punctuation\">}<\/span>\r\n<\/code><\/pre>\n<p>So, what\u2019s all that\u00a0<code>: DateTime<\/code>\u00a0stuff? It\u2019s telling you that the function\u00a0<code>foo<\/code>\u00a0will pass you an instance of the\u00a0<code>DateTime<\/code>\u00a0class. (The\u00a0<code>DateTime<\/code>\u00a0object is baked into PHP, and is used to represent, well,\u00a0<code>DateTime<\/code>s.) This lets me tell the things that will call my function (or class method, etc) what they should expect.<\/p>\n<p>Return types are also nullable (may sometimes return a null instead of the type they specify), which you might expect from the way it\u2019s declared:\u00a0<code>foo(): ?DateTime<\/code>\u00a0is a function that will either return\u00a0<code>null<\/code>\u00a0or a\u00a0<code>DateTime<\/code>\u00a0object.<\/p>\n<h3>SCALAR TYPE HINTS ARE NOW AVAILABLE<\/h3>\n<p>Upgrading our weird function from the last time, we can now also do \u201cscalar\u201d type hints in PHP. So we\u2019d have:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token keyword\">function<\/span> <span class=\"token function\">foo<span class=\"token punctuation\">(<\/span><\/span>string <span class=\"token variable\">$time_string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span> DateTime <span class=\"token punctuation\">{<\/span> \r\n    <span class=\"token keyword\">return<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">DateTime<\/span><span class=\"token punctuation\">(<\/span><span class=\"token variable\">$time_string<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<span class=\"token punctuation\">}<\/span>\r\n<\/code><\/pre>\n<p>As I mentioned above, in PHP 5 you couldn\u2019t specify anything but\u00a0<code>classes<\/code>,\u00a0<code>array<\/code>\u00a0and\u00a0<code>callable<\/code>\u00a0as parameter types. In PHP 7, we\u2019re able to also specify scalar types, like\u00a0<code>integer<\/code>,\u00a0<code>string<\/code>, etc. (For\u00a0a fuller understanding a scalar types in PHP, read this article.)<\/p>\n<h3>SIDENOTE: YOU CAN\u00a0<em>REQUIRE<\/em>\u00a0THE USE OF TYPES<\/h3>\n<p>In one of my favorite legitimate weirdnesses about PHP, you can declare that you want to\u00a0<em>require<\/em>\u00a0that all functions declare the types of their parameters and their returns. But you do it in a way that uses some \u201ctype juggling.\u201d To use the feature, you\u2019ll add at the top of a\u00a0<code>.php<\/code>\u00a0file (inside of\u00a0<code>&lt;?php<\/code>\u00a0tags), the following:<\/p>\n<pre class=\" language-php\"><code class=\" language-php\"><span class=\"token keyword\">declare<\/span><span class=\"token punctuation\">(<\/span>strict_types <span class=\"token operator\">=<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>\r\n<\/code><\/pre>\n<p>I think this is good practice, if you\u2019re trying to use strongly typed PHP code. But I also just think it\u2019s a funny reality that you\u2019re using an integer to set a boolean.<\/p>\n<h2>PHP 7 WordPress Code Will Be Better<\/h2>\n<p>In 2020, we\u2019ll be able to write PHP 7 WordPress code everywhere. It will be glorious. Or more accurately, it\u2019ll be a little better than what we\u2019ve been able to do for that last few years. There\u2019ll still be a lot of WordPress-reality we\u2019re also staring in the face of. But hopefully I\u2019ve shared some of my enthusiasm for these great features finally coming to WordPress that you\u2019re also getting excited. PHP future is awesome! And I\u2019m so glad it\u2019s finally arriving for WordPress.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>PHP has changed a lot in the last few years. And even before that, it had changed a lot. In short, modern PHP is a great and cool language, with only a few of the worst problems that people who last used it a decade age will remember. (Modern) PHP 7 and WordPress haven\u2019t really [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":915,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[],"class_list":["post-914","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","category-wordpress-tips"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>New features PHP7 for WordPress Developers<\/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:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"New features PHP7 for WordPress Developers\" \/>\n<meta property=\"og:description\" content=\"PHP has changed a lot in the last few years. And even before that, it had changed a lot. In short, modern PHP is a great and cool language, with only a few of the worst problems that people who last used it a decade age will remember. (Modern) PHP 7 and WordPress haven\u2019t really [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\" \/>\n<meta property=\"og:site_name\" content=\"Wordpress Development\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-24T08:52:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-24T08:54:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"284\" \/>\n\t<meta property=\"og:image:height\" content=\"178\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"smotiv\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"smotiv\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\"},\"author\":{\"name\":\"smotiv\",\"@id\":\"https:\/\/smo.vn\/blog\/#\/schema\/person\/400886672daf89b093ef3bafdb0d052e\"},\"headline\":\"New features PHP7 for WordPress Developers\",\"datePublished\":\"2019-05-24T08:52:20+00:00\",\"dateModified\":\"2019-05-24T08:54:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\"},\"wordCount\":1463,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/smo.vn\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg\",\"articleSection\":[\"General\",\"WordPress Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\",\"url\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\",\"name\":\"New features PHP7 for WordPress Developers\",\"isPartOf\":{\"@id\":\"https:\/\/smo.vn\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg\",\"datePublished\":\"2019-05-24T08:52:20+00:00\",\"dateModified\":\"2019-05-24T08:54:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage\",\"url\":\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg\",\"contentUrl\":\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg\",\"width\":284,\"height\":178},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/smo.vn\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"New features PHP7 for WordPress Developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/smo.vn\/blog\/#website\",\"url\":\"https:\/\/smo.vn\/blog\/\",\"name\":\"Wordpress Development\",\"description\":\"Vietnam Out Sourcing Services !\",\"publisher\":{\"@id\":\"https:\/\/smo.vn\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/smo.vn\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/smo.vn\/blog\/#organization\",\"name\":\"Wordpress Development\",\"url\":\"https:\/\/smo.vn\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smo.vn\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2020\/12\/cropped-smo-logo-e1609398962174.png\",\"contentUrl\":\"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2020\/12\/cropped-smo-logo-e1609398962174.png\",\"width\":240,\"height\":240,\"caption\":\"Wordpress Development\"},\"image\":{\"@id\":\"https:\/\/smo.vn\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/smo.vn\/blog\/#\/schema\/person\/400886672daf89b093ef3bafdb0d052e\",\"name\":\"smotiv\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smo.vn\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/da6682d4b35f6fcd898942787ca2a1e1ca3522d990aee85547e1ae3664f7e8ae?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/da6682d4b35f6fcd898942787ca2a1e1ca3522d990aee85547e1ae3664f7e8ae?s=96&d=mm&r=g\",\"caption\":\"smotiv\"},\"url\":\"https:\/\/smo.vn\/blog\/author\/smohub\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"New features PHP7 for WordPress Developers","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:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/","og_locale":"en_US","og_type":"article","og_title":"New features PHP7 for WordPress Developers","og_description":"PHP has changed a lot in the last few years. And even before that, it had changed a lot. In short, modern PHP is a great and cool language, with only a few of the worst problems that people who last used it a decade age will remember. (Modern) PHP 7 and WordPress haven\u2019t really [&hellip;]","og_url":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/","og_site_name":"Wordpress Development","article_published_time":"2019-05-24T08:52:20+00:00","article_modified_time":"2019-05-24T08:54:05+00:00","og_image":[{"width":284,"height":178,"url":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg","type":"image\/jpeg"}],"author":"smotiv","twitter_card":"summary_large_image","twitter_misc":{"Written by":"smotiv","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#article","isPartOf":{"@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/"},"author":{"name":"smotiv","@id":"https:\/\/smo.vn\/blog\/#\/schema\/person\/400886672daf89b093ef3bafdb0d052e"},"headline":"New features PHP7 for WordPress Developers","datePublished":"2019-05-24T08:52:20+00:00","dateModified":"2019-05-24T08:54:05+00:00","mainEntityOfPage":{"@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/"},"wordCount":1463,"commentCount":0,"publisher":{"@id":"https:\/\/smo.vn\/blog\/#organization"},"image":{"@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg","articleSection":["General","WordPress Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/","url":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/","name":"New features PHP7 for WordPress Developers","isPartOf":{"@id":"https:\/\/smo.vn\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage"},"image":{"@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage"},"thumbnailUrl":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg","datePublished":"2019-05-24T08:52:20+00:00","dateModified":"2019-05-24T08:54:05+00:00","breadcrumb":{"@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#primaryimage","url":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg","contentUrl":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2019\/05\/php7.jpg","width":284,"height":178},{"@type":"BreadcrumbList","@id":"https:\/\/smo.vn\/blog\/new-features-php7-for-wordpress-developers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smo.vn\/blog\/"},{"@type":"ListItem","position":2,"name":"New features PHP7 for WordPress Developers"}]},{"@type":"WebSite","@id":"https:\/\/smo.vn\/blog\/#website","url":"https:\/\/smo.vn\/blog\/","name":"Wordpress Development","description":"Vietnam Out Sourcing Services !","publisher":{"@id":"https:\/\/smo.vn\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smo.vn\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/smo.vn\/blog\/#organization","name":"Wordpress Development","url":"https:\/\/smo.vn\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smo.vn\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2020\/12\/cropped-smo-logo-e1609398962174.png","contentUrl":"https:\/\/smo.vn\/blog\/wp-content\/uploads\/2020\/12\/cropped-smo-logo-e1609398962174.png","width":240,"height":240,"caption":"Wordpress Development"},"image":{"@id":"https:\/\/smo.vn\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/smo.vn\/blog\/#\/schema\/person\/400886672daf89b093ef3bafdb0d052e","name":"smotiv","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smo.vn\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/da6682d4b35f6fcd898942787ca2a1e1ca3522d990aee85547e1ae3664f7e8ae?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/da6682d4b35f6fcd898942787ca2a1e1ca3522d990aee85547e1ae3664f7e8ae?s=96&d=mm&r=g","caption":"smotiv"},"url":"https:\/\/smo.vn\/blog\/author\/smohub\/"}]}},"_links":{"self":[{"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/posts\/914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/comments?post=914"}],"version-history":[{"count":3,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/posts\/914\/revisions"}],"predecessor-version":[{"id":917,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/posts\/914\/revisions\/917"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/media\/915"}],"wp:attachment":[{"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/media?parent=914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/categories?post=914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smo.vn\/blog\/wp-json\/wp\/v2\/tags?post=914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}