PHP 8.0 is released on November 26, 2020. You can download PHP 8.0 from php.net. It’s a new major version, which means it will have some breaking change and lots of new features and performance improvement. Due to breaking change, you need to update your code to run on the latest version of PHP 8.0.
PHP 8.0 will come with some new features such as the JIT compiler, union types, attributes, and more.
List of New Feature in PHP 8.0
- Named Arguments
- Constructor property promotion
- Union types
- Match expression
- Nullsafe operator
- Saner string to number comparisons
- Consistent type errors for internal functions
- JIT (Just in time compiler)
Now before I start explaining to you all the above new features in detail first we need to install the latest PHP version 8.0.
Installation of PHP 8.0 Ubuntu
We need to add
ondrej/php PPA as a source of packages, that contains all the latest PHP packages and their dependencies.
sudo add-apt-repository ppa:ondrej/php sudo apt-get update
To install PHP 8.0 extensions you need to run this command
sudo apt install php8.0-common php8.0-cli -y
This command will install several PHP extensions due to
php8.0-common, and the CLI for PHP 8.0.
You can check PHP Version by running this command
PHP -v. To install PHP fpm run the bellow command
sudo apt install php8.0-fpm
Now with the help of the above command, your PHP 8.0 is installed successfully now you can write your code and test the latest feature of PHP 8.