diff --git a/language/functions.xml b/language/functions.xml index 4277add82b..8ca45c8808 100644 --- a/language/functions.xml +++ b/language/functions.xml @@ -176,7 +176,36 @@ function recursion($a) Information may be passed to functions via the argument list, which is a comma-delimited list of expressions. The arguments are evaluated from left to right. - + + + + + + + &Version; + &Description; + + + + + 5.1.0 + classes,interfaces and arrays type declaration + + + 5.4.0 + callable type declaration + + + 7.0.0 + scalar (int, + float, + string, + bool) type declaration + + + + + PHP supports passing arguments by value (the default), passing by @@ -199,8 +228,7 @@ function takes_array($input) ]]> - - + Making arguments be passed by reference @@ -232,9 +260,7 @@ echo $str; // outputs 'This is a string, and something extra.' - - Default argument values @@ -356,9 +382,143 @@ Making a bowl of acidophilus raspberry. As of PHP 5, arguments that are passed by reference may have a default value. - + + Scalar Type Declaration + + + + Type declaration is also known as Type Hinting. + + + PHP 7 introduces scalar type declaration. Functions are now able to force parameters + to be string, int, float or bool. + By default all PHP Files are in weakly typed mode. + To enable strict type checking, declare(strict_types=1) + directive must be the first + statement in the file. strict_types has two options, 1 for strict type + checking and 0 for weak type checking. This only affects the file this is stated in and not + files either included in this file or other files that include this file. + Whether or not the function being called was declared in a file that uses strict or weak + type checking is irrelevant. The type checking mode depends on the file where the function is called from. + + + + Scalar Type Declaration examples + + + + + + + + +]]> + + + + + + +]]> + + + + + + + + + Type Widening + + + + + + + Variable-length argument lists