Home  >  Article  >  Backend Development  >  What is the difference between php 5.6 and 7.0

What is the difference between php 5.6 and 7.0

青灯夜游
青灯夜游Original
2021-06-03 18:20:212375browse

Differences: 1. The performance of PHP7.0 is twice that of PHP5.6; 2. PHP7.0 fully supports 64-bit, but 5.6 cannot; 3. PHP7.0 adds the null combination operator "?? ", function return type declaration, scalar type declaration, anonymous class; 4. In PHP7.0, define can define constant arrays, etc.

What is the difference between php 5.6 and 7.0

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

PHP5.6 and PHP7.0 Difference

  • #PHP7.0 has twice the performance improvement than PHP5.6.

  • PHP7.0 fully supports 64-bit.

  • Fatal errors that occurred before PHP7.0 were changed to throwing exceptions.

  • Added null combination operator (??). The effect is equivalent to the ternary operator.

  • PHP7.0 adds a new function return type declaration.

  • PHP7.0 adds a new scalar type declaration.

     The formal parameter type declaration of a function in PHP 7 can be a scalar. In PHP 5, it can only be a class name, interface, array or callable (PHP 5.4, it can be a function, including anonymous functions). Now you can also use string, int, float and bool.

  • Newly added anonymous class.

    PHP 5.3 started to have anonymous functions, and now anonymous classes have been added;

  • After PHP7.0, some old SAPIs that are no longer supported have been removed. (server-side application programming port) and extensions.

  • #define It is now possible to define constant arrays.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the difference between php 5.6 and 7.0. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn