Introducing new features of PHP 7.<br />
<br />
php 7新功能<br />
php 7 nieuwe functies<br />
<br />
php 7 novaj karakterizaĵoj<br />
Php 7 nouvelles fonctionnalités<br />
<br />
Php 7 neue Funktionen<br />
<br />
PHP 7の新機能<br />
<br />
VII nova PHP<br />
<br />
PHP 7 новых функций<br />
<br />
Php 7 nuevas características<br />
<br />
Scalar Type Hints:<br />
<br />
1.Type declarations simply means specifying which type of variable is being set instead of allowing PHP to set this automatically.<br />
2.Type declarations can help you define what should occur so that you get the expected results. <br />
3.With PHP 7, by adding scalar type hints and enabling strict requirements, it is hoped that more correct and self-documenting PHP programs can be written. It also gives you more control over your code and can make the code easier to read.<br />
4.By default, scalar type-declarations are non-strict, which means they will attempt to change the original type to match the type specified by the type-declaration.<br />
<br />
Return Type Deceleration:<br />
<br />
1.PHP 7 also supports Return Type Declarations.<br />
2.To specify the return type, we add a colon and then the type right before the opening curly bracket. <br />
3.function add(int $a, int $b): int{<br />
4.The same strictness rules apply as with the type hints: if “strict mode” is disabled, return values that can be converted to the preferred type are allowed. If you enable “strict mode” this code will throw a type error.<br />
<br />
<br />
Anonymous classes<br />
<br />
With anonymous classes you can define a class and instantiate an object inline.<i class="fa fa-language transViewIcon clickable" title="Translation"></i>
php 7 novaj karakterizaĵoj
Php 7 nouvelles fonctionnalités
Php 7 neue Funktionen
PHP 7の新機能
VII nova PHP
PHP 7 новых функций
Php 7 nuevas características
Scalar Type Hints:
1.Type declarations simply means specifying which type of variable is being set instead of allowing PHP to set this automatically.
2.Type declarations can help you define what should occur so that you get the expected results.
3.With PHP 7, by adding scalar type hints and enabling strict requirements, it is hoped that more correct and self-documenting PHP programs can be written. It also gives you more control over your code and can make the code easier to read.
4.By default, scalar type-declarations are non-strict, which means they will attempt to change the original type to match the type specified by the type-declaration.
Return Type Deceleration:
1.PHP 7 also supports Return Type Declarations.
2.To specify the return type, we add a colon and then the type right before the opening curly bracket.
3.function add(int $a, int $b): int{
4.The same strictness rules apply as with the type hints: if “strict mode” is disabled, return values that can be converted to the preferred type are allowed. If you enable “strict mode” this code will throw a type error.
Anonymous classes
With anonymous classes you can define a class and instantiate an object inline.
View comments