In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "what are the differences between php5.6 and php7". The editor shows you the operation process through actual cases, the operation method is simple and fast, and it is practical. I hope this article "what are the differences between php5.6 and php7" can help you solve the problem.
The difference between php5.6 and php7: 1, function return type declaration has been added in php7; 2, scalar type declaration has been added in php7; 3, anonymous class has been added in php7; 4. Php7 has removed some SAPI and extensions that are no longer supported.
Operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer
What's the difference between php5.6 and php7?
First, the difference between the two
1.PHP7.0 has two times better performance than PHP5.6.
2.PHP7.0 fully and consistently supports 64-bit.
The fatal mistakes made by 3.PHP7.0 have been changed to throwing the agenda.
4. Added the empty binding operator (? Equivalent to the ternary operator.
5.PHP7.0 added a return type declaration for the function.
Scalar type declaration has been added to 6.PHP7.0.
The formal parameter type declaration of a function in 7.PHP7 can be scalar. In PHP5, it can only be class names, interfaces, arrays, or callable (PHP5.4, that is, functions, including anonymous functions). Now you can also use string, int, float, and bool.
Anonymous classes have been added to 8.PHP7.0.
9.PHP7.0 has since removed some old SAPI (server-side application programming ports) and extensions that are no longer supported.
10.define can define constant arrays.
II. New features of PHP7.0
1. Declaration of type
You can use strings (string), integers (int), floating point numbers (float), and Boolean values (bool) to declare the parameter type and return value of the function.
Scalar declaration type mode: mandatory mode (default mode) and strict mode
Declare (strict_types=1), must be placed at the top to ensure that the file execution is valid.
two。 Exception handling
PHP7.0 avoids previous fatal errors, but by inheriting the Error class and throwing errors, giving developers more control over the program.
3. New operator''
Syntax: $x = $y $z
If $y > $z, the value of $x is 1
If $y = = $z, the value of $x is 0
If $y < $z, the value of $x is-1
4. Increase the operating fee "?"
If the variable exists and the value is not NULL, its own value is returned, otherwise the second Operand is returned.
5.define () defines a constant array
6. Anonymous function
7.Unicode character format support (echo "/ u {1234}")
8.Unserialize provides filtering features
Prevents illegal data from code injection, providing more secure deserialization of data.
9. Namespace reference optimization
Files in the same folder support the introduction of an array
Third, how to give full play to PHP7 performance
1. Turn on Opcache
Zend_extension=opcache.so opcache.enable=1 opcache.enable_cli=1
two。 Compile with GCC 4.8or above
3. Turn on HugePage
4.PGO (Profile Guided Optimization)
This is the end of the content about "what are the differences between php5.6 and php7". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.