diff --git a/language/oop5/typehinting.xml b/language/oop5/typehinting.xml index 5a2cb930b5..fe1ae2fe40 100644 --- a/language/oop5/typehinting.xml +++ b/language/oop5/typehinting.xml @@ -1,11 +1,13 @@ - + Type Hinting PHP 5 introduces Type Hinting. Functions are now able to force parameters to be objects (by specifying the name of the class in the function - prototype) or arrays (since PHP 5.1). + prototype) or arrays (since PHP 5.1). However, if NULL is used + as the default parameter value, it will be allowed as an argument for any + later call. @@ -97,6 +99,24 @@ function MyFunction (MyClass $foo) { // Works $myclass = new MyClass; MyFunction($myclass); +?> +]]> + + + Type hinting allowing NULL value: + + + ]]>