What is the role of the scalar type and return type declaration added in PHP 7?

Source: Internet
Author: User
The scalar type and return type declaration are added to PHP 7. I checked the information and found that the efficiency was not greatly improved. So what is the role of this scalar type and return type declaration? The scalar type and return type declaration are added to PHP 7.

I checked the information and found that the efficiency was not greatly improved.

So what is the role of this scalar type and return type declaration?

Reply content:

The scalar type and return type declaration are added to PHP 7.

I checked the information and found that the efficiency was not greatly improved.

So what is the role of this scalar type and return type declaration?


This feature was originally designed to optimize JIT compilation, but later JIT was not introduced into PHP7, but the strong type was left behind. In PHP, theoretically, a strong type will cause performance loss. In addition, currently, strong types can be used for type detection and forced type conversion.


After further research, we found that the function is to limit the return type. When the inherited object re-override method is used, the returned results are unified without calling problems.

The above are the scalar type and return type declarations added in PHP 7. what is the role of them? For more information, see The PHP Chinese website (www.php1.cn )!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.