php 的函数参数值类型限定

如例:

function test(array $a,test $b){

/*...*/

}

class test{

/*...*/

}

test(array(),new test);

表示test函数的参数里,第一个参数必须是数组,第二个必须是test类的实体。php没有别的限定类型了,诸如string、integer这样的限定类型是没有的,只有数组和对象两种限定类型。

原文地址:https://www.cnblogs.com/kenshinobiy/p/4288495.html