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.
精彩评论