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
<?php Failing to satisfy the type hint results in a catchable fatal error.
<?php Type hinting also works with functions:
<?php Type hinting allowing NULL value:
<?php Type 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
more
Last requests
|