PHP » PYTHON |
login |
register |
about
|
|
Type HintingPHP 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). However, if NULL is used as the default parameter value, it will be allowed as an argument for any later call. Example #1 Type Hinting examples
<?phpFailing to satisfy the type hint results in a catchable fatal error.
<?phpType hinting also works with functions:
<?phpType hinting allowing NULL value:
<?phpType Hints can only be of the object and array (since PHP 5.1) type. Traditional type hinting with int and string isn't supported. |
more
Recently updated
more
Most requested
|