{"id":6126,"date":"2015-12-03T22:24:31","date_gmt":"2015-12-03T21:24:31","guid":{"rendered":"https:\/\/www.combell.com\/en\/blog\/?p=6126"},"modified":"2015-12-04T11:15:35","modified_gmt":"2015-12-04T10:15:35","slug":"php-7-is-now-available-and-these-are-the-new-features","status":"publish","type":"post","link":"https:\/\/www.combell.com\/en\/blog\/php-7-is-now-available-and-these-are-the-new-features\/","title":{"rendered":"PHP 7 is now available and these are the new features"},"content":{"rendered":"<p style=\"text-align: right; margin-top: -35px!important;\"><a href=\"https:\/\/www.combell.com\/nl\/blog\/php-7-is-er-en-nieuwe-features\/\" target=\"_blank\">Lees in het Nederlands<\/a> - <a href=\" https:\/\/www.combell.com\/fr\/blog\/php-7-est-arrive-voici-ses-nouvelles-fonctionnalites\/\" target=\"_blank\">Lisez en fran\u00e7ais<\/a><\/p>\n<p>PHP 7 is finally available... What a magnificent end of year gift for all developers!<\/p>\n<p>The many PHP developers were really looking forward to discovering the new version of this programming language, particularly as it promised to deliver much better performance. But PHP 7 has much more to offer. Combell technology evangelist <a href=\"https:\/\/twitter.com\/ThijsFeryn\" target=\"_blank\" rel=\"noopener\">Thijs Feryn<\/a> gives some explanation (<a href=\"http:\/\/blog.feryn.eu\/2015\/12\/02\/php-7-is-now-available\/\" target=\"_blank\" rel=\"noopener\">click here for a technical version with more details and code examples on Thijs\u2019s<\/a> personal blog).<\/p>\n<h2>Lightning-fast with PHP 7 thanks to the PHP Next Generation engine<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6127\" title=\"Lightning-fast with PHP 7 thanks to the PHP Next Generation engine\" src=\"https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/Lightning-fast-with-PHP-7-thanks-to-the-PHP-Next-Generation-engine.png\" alt=\"Lightning-fast with PHP 7 thanks to the PHP Next Generation engine\" width=\"120\" height=\"120\" srcset=\"https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/Lightning-fast-with-PHP-7-thanks-to-the-PHP-Next-Generation-engine.png 1024w, https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/Lightning-fast-with-PHP-7-thanks-to-the-PHP-Next-Generation-engine-50x50.png 50w, https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/Lightning-fast-with-PHP-7-thanks-to-the-PHP-Next-Generation-engine-300x300.png 300w, https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/Lightning-fast-with-PHP-7-thanks-to-the-PHP-Next-Generation-engine-60x60.png 60w\" sizes=\"(max-width: 120px) 100vw, 120px\" \/>There is no need to tell you once again that PHP is very popular among developers. Back when it was created by Rasmus Lerdorf, in 1994, PHP stood for Personal Home Page. Today, the language has become an efficient and versatile tool for developing websites, partly thanks to the very active community of developers who constantly improve this language.<\/p>\n<p>But this week, a new milestone was reached in the evolution of this language: PHP version 7.0 has been released. The first thing we notice is its impressive performance, which results from the new\u00a0<a href=\"https:\/\/wiki.php.net\/rfc\/phpng\" target=\"_blank\" rel=\"noopener\">PHP Next Generation engine<\/a>, the successor of the old Zend Engine. This new engine is claimed to be twice as fast as the previous version, PHP 5.6.<\/p>\n<h2>Scalar type hints and return type declarations<\/h2>\n<p>However, this new version has much more to offer. You can e.g. use <a href=\"https:\/\/wiki.php.net\/rfc\/scalar_type_hints_v5\" target=\"_blank\" rel=\"noopener\">scalar type hints<\/a>. Originally, PHP was a loosely typed language, which means that variables are not declared with strict data types, so that a variable in a script can be assigned a value of a different type than the one of the original value.<\/p>\n<p>That makes PHP extremely flexible, but sometimes also unreliable, because errors are not reported immediately. This is why, over time, <a href=\"http:\/\/php.net\/manual\/en\/functions.arguments.php#functions.arguments.type-declaration\" target=\"_blank\" rel=\"noopener\">type hints<\/a>\u00a0have been added: if a value does not match the type hint, a warning is thrown. And that was a great idea, but until now these type hints were limited to objects, arrays and callables.<\/p>\n<p>This is why PHP 7 presents <a href=\"https:\/\/wiki.php.net\/rfc\/scalar_type_hints_v5\" target=\"_blank\" rel=\"noopener\">scalar type hints<\/a>: integers, strings, booleans and floats can now also be used as type hints. Moreover, <a href=\"https:\/\/wiki.php.net\/rfc\/return_types\" target=\"_blank\" rel=\"noopener\">return type declarations<\/a> are now supported. As a developer, this allows you to make sure that the output of functions and methods is consistent.<\/p>\n<p>When you run PHP in standard mode (coercive), PHP will only report errors when it returns a wrong type that cannot be converted to the desired type. The string \u201c12\u201d will e.g. be allowed if the interface of the function or method expects an integer. But if you activate strict mode, PHP will be less forgiving and throw an error when the types do not completely match.<\/p>\n<h2>Operators: Nulls... and Space ships<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6128\" title=\"PHP 7 Operators and space ships\" src=\"https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-Operators-and-space-ships.jpg\" alt=\"PHP 7 Operators and space ships\" width=\"200\" height=\"154\" srcset=\"https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-Operators-and-space-ships.jpg 648w, https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-Operators-and-space-ships-300x231.jpg 300w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>PHP 7 also introduced a couple of new operators: the\u00a0<a href=\"https:\/\/wiki.php.net\/rfc\/isset_ternary\" target=\"_blank\" rel=\"noopener\">null coalesce operator<\/a>\u00a0and the\u00a0<a href=\"https:\/\/wiki.php.net\/rfc\/combined-comparison-operator\" target=\"_blank\" rel=\"noopener\">spaceship operator<\/a>.<\/p>\n<p>The null coalesce operator is a ternary operator, which checks whether the evaluated value exists and if it is not null. If it is the case, the value is returned. If not, an alternative value is returned.<\/p>\n<p>As for the spaceship operator (we really love that name!), it makes it possible to define whether a value is greater than, less than or equal to another value. This is expressed with 0 (equal to), -1 (less than) or 1 (greater than).<\/p>\n<h2>Anonymous classes<\/h2>\n<p>We should also mention classes. In PHP\u2019s object-oriented model, classes are explicitly declared, and later explicitly instantiated to objects. From PHP 7, it is possible to declare <a href=\"https:\/\/wiki.php.net\/rfc\/anonymous_classes\" target=\"_blank\" rel=\"noopener\">anonymous classes<\/a>. These are classes that are declared on the fly, much like anonymous functions ( ~ callbacks) that have been available in PHP 5 for a while now.<\/p>\n<h2>But... what about PHP 6?<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-6129\" title=\"PHP 7 is here and this is what you should know\" src=\"https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-here-and-this-is-what-you-should-know.jpeg\" alt=\"PHP 7 is here and this is what you should know\" width=\"200\" height=\"119\" srcset=\"https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-here-and-this-is-what-you-should-know.jpeg 1033w, https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-here-and-this-is-what-you-should-know-300x179.jpeg 300w, https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-here-and-this-is-what-you-should-know-1024x610.jpeg 1024w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>Attentive readers will probably wonder why this new version is named PHP 7.0, given that the previous version was named PHP 5.6. So, what exactly happened to PHP 6? Well, PHP 6 has definitely existed, but it has never been released. The main purpose of PHP 6 was indeed to provide full Unicode support, also at the level of the language itself.\u00a0But that goal appeared to be impossible to reach and PHP 6 was pronounced dead. The other features that PHP 6 should have introduced were added to PHP 5.3.<\/p>\n<p>Although PHP 6 has never seen the light of day, the project did exist within the PHP core group.\u00a0<a href=\"https:\/\/wiki.php.net\/rfc\/php6\" target=\"_blank\" rel=\"noopener\">This is precisely why the decision was taken to name the new version PHP 7<\/a>.<\/p>\n<h2>More info?<\/h2>\n<p>PHP offers many other new features that are too numerous to discuss in this article. Feel free to visit\u00a0<a href=\"http:\/\/php.net\/manual\/en\/migration70.new-features.php\" target=\"_blank\" rel=\"noopener\">http:\/\/php.net\/manual\/en\/migration70.new-features.php<\/a>\u00a0for a complete overview.<\/p>\n<p>Our colleague, <a href=\"https:\/\/twitter.com\/ThijsFeryn\" target=\"_blank\" rel=\"noopener\">Thijs<\/a>, has once again lived up to his reputation as a technology evangelist at Combell: he made a video to explain the main features using code examples.<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/Yhn5snJGvAo?rel=0\" width=\"640\" height=\"360\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>He also wrote\u00a0<a href=\"http:\/\/blog.feryn.eu\/2015\/12\/02\/php-7-is-now-available\/\" target=\"_blank\" rel=\"noopener\">a technical blog post<\/a>\u00a0about it with additional details and code examples.<\/p>\n<h2><strong>Do you want to use PHP 7 on your hosting account?<\/strong><\/h2>\n<p>That is possible!\u00a0<a href=\"https:\/\/www.combell.com\/en\/hosting\/php-webhosting\">We already have PHP 7.0.0 available on our shared hosting packages<\/a>. Go to your\u00a0<a href=\"https:\/\/my.combell.com\/en\" target=\"_blank\" rel=\"noopener\">My Combell control panel<\/a>\u00a0to migrate from PHP 5 to PHP 7. Do you want to use PHP 7 on your Cloud server? That is possible too! Please contact our helpdesk. If necessary, our collaborators can compile PHP 7 on your system.<\/p>\n<p style=\"text-align: center;\"><a class=\"cta_button\" href=\"https:\/\/www.combell.com\/nl\/hosting\/php-webhosting\">Click here to order PHP 7 hosting<\/a><\/p>\n<p>One last thing: PHP 7 also includes a few <a href=\"http:\/\/php.net\/manual\/en\/migration70.incompatible.php\" target=\"_blank\" rel=\"noopener\">backwards incompatible changes<\/a>. Go to\u00a0<a href=\"http:\/\/php.net\/manual\/en\/migration70.incompatible.php\" target=\"_blank\" rel=\"noopener\">http:\/\/php.net\/manual\/en\/migration70.incompatible.php<\/a>\u00a0and check whether your code is compatible with these changes.<\/p>\n<p>Good luck with your lightning-fast PHP!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lees in het Nederlands - Lisez en fran\u00e7ais PHP 7 is finally available... What a magnificent end of year gift for all developers! The many PHP developers were really looking...<\/p>\n","protected":false},"author":5,"featured_media":6130,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[68,61,66,63,75,72],"tags":[165,252,254,255,166],"acf":[],"uagb_featured_image_src":{"full":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",850,290,false],"thumbnail":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-50x50.jpeg",50,50,true],"medium":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-300x102.jpeg",300,102,true],"medium_large":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",768,262,false],"large":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",850,290,false],"1536x1536":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",850,290,false],"2048x2048":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",850,290,false],"post-featured":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",850,290,false],"post-featured-opt":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-750x256.jpeg",750,256,true],"post-featured-opt-md":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features.jpeg",850,290,false],"post-featured-opt-sm":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-485x165.jpeg",485,165,true],"post-featured-opt-xs":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-375x128.jpeg",375,128,true],"post-most-popular":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-50x50.jpeg",50,50,true],"post-author":["https:\/\/www.combell.com\/en\/blog\/files\/2015\/12\/PHP-7-is-now-available-and-these-are-the-new-features-60x60.jpeg",60,60,true]},"uagb_author_info":{"display_name":"Romy","author_link":"https:\/\/www.combell.com\/en\/blog\/author\/romy\/"},"uagb_comment_info":0,"uagb_excerpt":"Lees in het Nederlands - Lisez en fran\u00e7ais PHP 7 is finally available... What a magnificent end of year gift for all developers! The many PHP developers were really looking...","_links":{"self":[{"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/posts\/6126"}],"collection":[{"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/comments?post=6126"}],"version-history":[{"count":3,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/posts\/6126\/revisions"}],"predecessor-version":[{"id":6133,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/posts\/6126\/revisions\/6133"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/media\/6130"}],"wp:attachment":[{"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/media?parent=6126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/categories?post=6126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.combell.com\/en\/blog\/wp-json\/wp\/v2\/tags?post=6126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}