PHP5 what is the use case of type hiting in php
function(myCar $cars)
In P开发者_JS百科HP5, type hinting is a specifying class name before object variable in a function parameters.
I know what is type hinting, but what is the exact use case in PHP5?
Have a look at the examples in the documentation:
Failing to satisfy the type hint results in a catchable fatal error.
It helps to detect errors or wrong usage of functions.
精彩评论