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 )!