开发者

PHP5 what is the use case of type hiting in php

开发者 https://www.devze.com 2023-03-13 22:55 出处:网络
function(myCar $cars) In P开发者_JS百科HP5, type hinting is a specifying class name before object variable in a function parameters.
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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号