1.

Explain Scalar Type Declarations In Php7?

Answer»

SCALAR type declarations is the new feature in PHP7 that has added new declaration types such as INT, string, Boolean, FLOAT.

This declaration has two options-

Coercive– this is a default mode in scalar type declarations, which need not be specified.

Strict– it has to be explicitly HINTED.

Scalar declarations have attracted a lot of controversy regarding its IMPLEMENTATION. These are the statements that accept the arguments (parameters) and returns the values of the given scalar data type which can be int, float, string, etc. To stimulate this function, the name of the scalar data type should be added before the parameter.

FUNCTION: FunctionName (int $a, int $b)

{return $a +$b; }

Scalar type declarations is the new feature in PHP7 that has added new declaration types such as int, string, Boolean, float.

This declaration has two options-

Coercive– this is a default mode in scalar type declarations, which need not be specified.

Strict– it has to be explicitly hinted.

Scalar declarations have attracted a lot of controversy regarding its implementation. These are the statements that accept the arguments (parameters) and returns the values of the given scalar data type which can be int, float, string, etc. To stimulate this function, the name of the scalar data type should be added before the parameter.

FUNCTION: FunctionName (int $a, int $b)

{return $a +$b; }



Discussion

No Comment Found