The new features of PHP7 are: 1. Significantly reduced memory usage; 2. Abstract syntax tree; 3. Consistent 64-bit support; 4. Improved exception hierarchy; 5. Improved exception hierarchy; 6 , Many fatal errors are converted into exceptions; 7. Secure random number generator; 8. Remove old and unsupported SAPI and extensions, etc.
PHP 7 is the first major version update of PHP in several years. PHP7 runs faster than previous versions and is more stable due to changes in the way errors are handled. Dynamic websites built with popular content management systems (CMS) like WordPress run more efficiently and are less likely to crash than previous PHP versions.
Recommended reference: "PHP7 New Features Manual"
From the official PHP documentation:
1. Performance improvement: PHP 7 is twice as fast as PHP 5.6
2, significantly reduces memory usage
3, abstract syntax tree
4, consistent 64-bit support
5. Improved exception hierarchy
6. Many fatal errors are converted into exceptions
7. Secure random number generator
8. Delete old and incorrect ones Supported SAPI and extensions
9, Null coalescing operator (??)
10, Return and scalar type declaration
11, Anonymous classes
12. Zero-cost assertion
Tip:
The official PHP 7 documentation states that “Although PHP 7.0 is a new major version, every effort has been made to make migration as easy as possible . This release is primarily focused on removing features that were deprecated in previous releases and improving language consistency. "However, there are still backward compatibility issues that may be encountered.
Before upgrading, review the complete list of backwards-incompatible changes. This is not an issue for a newly configured server with a new site, but it may still be an issue if you plan to migrate a site that uses an older version of PHP. One possible solution is to test your site or application in a virtual environment first. A well documented Vagrant PHP testing environment can be found here.
Please keep in mind that while it is possible to run multiple versions of PHP on the same server, this may result in an unstable environment.
The above is the detailed content of What are the new features of PHP 7?. For more information, please follow other related articles on the PHP Chinese website!