开发者

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

开发者 https://www.devze.com 2023-03-03 05:54 出处:网络
Just curious, using LAMP. In the following public function zhou(array $shenme){ } What is the pur开发者_如何转开发pose of \"array\" there?

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

精彩评论

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