The programming language “PHP” has become an integral part of the World Wide Web. It is installed on many web servers around the world and allows webmasters, web designers and programmers to expand their internet presence in terms of functionality. The first version appeared 25 years ago, in 1995.
After a long test phase, the final version 8.0 of PHP has now been released.
It brings some interesting innovations. This includes a just-in-time compiler (JIT), with the help of which PHP scripts are to be executed faster in some cases. Instead of compiling the entire script and then executing it, it does it line by line.
Another interesting innovation are the so-called “Union Types” – a new data type that can combine several types of ordinary variables (e.g. integer, boolean, etc.).
New functions have also been added, for example to check whether a certain character string occurs in a string (str_contains, str_starts_with, str_ends_with) or to return an ID in the form of an integer from a handle (get_resource_id).
Error messages have also been revised in PHP 8. They now indicate whether it is a warning, a note or a critical error. This is particularly helpful for development because it enables the programmer to recognize more quickly the relevance of the error message. The sorting function has also been made more reliable.
This is how you get PHP 8
It will be a while before all major hosting providers switch their hosting packages to PHP 8. Whether existing scripts have to be adapted depends on their content and range of functions. In the case of scripts that perform “normal” website tasks (contact forms, simpler database applications, etc.), adaptation will probably not be necessary in most cases. However, very old scripts that were originally developed for PHP 4 could be affected. In PHP 8 some very old functions are no longer available. In this case, an adjustment would be necessary in some places.
If you don’t want to wait for your hosting provider, you can install the “XAMPP” software on your local PC. Among other things, it installs a PHP server on the local hard drive that can be used to develop PHP scripts. This saves the annoying upload to an FTP server when testing and you can even develop offline with PHP (e.g. when you are on the train without internet). At the time of writing this article, no XAMPP version containing PHP 8 was available. But this is completely normal because PHP 8 has only just been released.
Video: What’s new in PHP 8.0