PHP 8 available on all HostArmada services
Categories:
8 minutes reading
PHP is still the most widely used server-side programming language for dynamic websites. In fact, according to W3Techs’ report, it empowers 79.1% of all websites with known server-side programming logic. To put that into a better perspective, the overwhelming majority of websites are currently up and running around the internet with PHP’s help. That is why we are very excited to announce that HostArmada has now made the newest and most requested PHP version available – PHP 8 on all our web hosting solutions!
It’s available, but what exactly is new?
PHP version 8.0 is a significant update over the 7.4 branch of the PHP programming language. There are many new features and optimizations, including named arguments, union types, attributes, constructor property promotion, match expression, nullsafe operator, and JIT. It introduced improvements in the type system, error handling, and consistency. According to the PHP 8 roadmap, many long-expected, exciting features and enhancements have arrived with the release.
It adds much more clarity, transparency, efficiency to the development workflow and gives developers a chance to build better, faster, and safer websites and applications. Many built-in functions are now pickier about the input they accept, and PHP 8 itself is more stringent about how that information is passed to functions. Issues that previously resulted in notices directly result in warnings. And issues that resulted in warnings now result in errors. In other words, PHP 8 is not as lenient as previous versions. It will not try quite as hard to make code work no matter what.
What does having PHP 8 available mean for your existing applications?
Should you upgrade your online projects immediately? Probably not. First of all, you should confirm that everything is working with PHP version 7.4. Because of the many new features and improvements, there’s a higher chance you’ll need to make some changes in your PHP code to get it fully adapted to the new PHP 8. If you’ve maintained your code up to date with the latest releases, though, the upgrade shouldn’t be too hard since most breaking changes that could occur were deprecated before in the 7.* versions.
New major features breakdown
Here are some of the most important major features PHP 8 introduces:
- Attributes – Also known as annotations in other languages, provide a mechanism to add metadata to your codebase. Attributes can be used with classes, methods, functions, and properties. They’re easier to work with than the docblock approach adopted by many PHP 7 projects.
- Constructor Property Promotion – PHP 8 adds support for Constructor Property Promotion, a shorthand syntax that lets you combine property definition, type-hinting, and population inline in the constructor’s signature.
- JIT – The JIT — just in time — compiler promises significant performance improvements. It is implemented and introduced as an almost independent part of OPcache.
- Union Types – PHP’s type system continues to develop with PHP 8. It’s now possible to hint types as a “union” of two or more types, where the type’s value can derive from any of the types in the union.
- Match Expression – The new match expression is presented as a compact, safer alternative to the commonly known switch. It does not require the use of case and break statements, supports combined conditions, and returns a value instead of entering a new code block.
- Nullsafe Operator – PHP 8 now supports inline null checking with automatic short-circuiting with the use of the Nullsafe Operator. You can build up a chain of checks that will abort, returning null when evaluating any element fails.
- Stricter Type System – A fair number of changes in this area enhance the strictness and consistency with which type checking is enforced.
- Named Arguments – Named Arguments allow you to pass in values to a function by specifying the value name so that you don’t have to consider their order. You can also skip optional parameters!
How to upgrade to PHP 8?
The cPanel service offered with our Shared Hosting solutions has an easy-to-use feature known as “PHP selector”. That is what you can use to change your PHP version to PHP 8. Please bear in mind this update to the arrangement will affect all the websites hosted on the cPanel. For the convenience of our clients, we have published a HostArmada PHP selector tutorial where you can find a step-by-step guide on changing your PHP version, as well as additional information on how to use it effectively and manage your PHP extensions.
If you are a client of our Cloud SSD VPS or Dedicated CPU solutions, the PHP 8 is available on demand. The only thing you will need to do is to submit a ticket via your Client Area with HostArmada and request the installation and configuration of PHP 8.
If you still have questions or encounter issues with this process, despite our guide, there is nothing to worry about because our expert support team is here to help at any time as we are available 24/7.