Home >Backend Development >PHP Problem >There are several versions of php language

There are several versions of php language

王林
王林Original
2019-10-10 11:49:458748browse

There are several versions of php language

##The major versions of PHP are mainly divided into four branches: PHP4/PHP5/PHP6/PHP7

Among them, PHP4 is too old and does not support OO. Incompetence has been basically eliminated, please ignore PHP4.

PHP6 has basically no production line applications and is basically just a concept product. Many functions have been implemented on PHP5.3.3, so I won’t go into details. Please ignore PHP6.

The versions of PHP5 are mainly divided into four branches: versions before PHP5.2, PHP5.2.X, PHP5.3 and the recently released PHP5.4.

The latest stable version of php7 is 7.2.10, and there are still many projects using 5.6 or even earlier versions. Compared with the php5.x version, php7 has many new improvements and performance improvements.


So how should we choose the version suitable for our own project?

Versions before PHP5.2 are not worth considering because of some functional defects or BUGs. Versions before PHP5.2. PHP5.4 is still in Beta version and is not a stable version. Please ignore PHP5.4.

Mainstream PHP programs have the best compatibility with PHP5.2.X, and each version upgrade brings improvements in security and stability, so you should choose the latest version. Currently, the latest version of the PHP5.2 series is PHP5.2.17.

If the product is developed and used by oneself, PHP5.3 has advantages in some aspects, is superior in stability, and adds many functions that PHP5.2 does not have, such as built-in php- fpm, a more complete garbage collection algorithm, the introduction of namespaces, sqlite3 support, etc., are versions worth considering for deployment projects, and PHP5.3.3 is highly recommended.

In addition to the differences in version numbers, PHP versions with the same version number are also different, and you need to pay attention when choosing a PHP extension.

New features of PHP7

1. Scalar type declaration

Parameters in functions/methods can be Add a type declaration, which has been supported since php5.0.

2. Return value type declaration

There are several versions of php language
##The type of return value, Consistent with the parameter type.

Note:

By default, if the function return value is inconsistent with the definition, it will be forced to convert. In strict mode, a TypeError will be reported.

3. Newly added random function

There are several versions of php language

4. Newly added Functions for integer division

There are several versions of php language

5. use grouping namespace

There are several versions of php languageRecommended tutorial:

PHP video tutorial

The above is the detailed content of There are several versions of php language. 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