开发者

adding a type before a variable in a function parameter list in php

Just curious, using LAMP.

In the following

public function zhou(array $shenme){

}

What is the pur开发者_如何转开发pose of "array" there?

Cheers

Jason


It is Type Hinting (EN) or Tipos Sugeridos (ES) as explained in the manual.


In php you can force a function parameter to be of a certain class. In this case it must be an array. Keep in mind that you can only do this for class names and array not string or boolean or integer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜