php:声明函数的参数类型
我正在尝试使用声明的参数类型创建一个函数,以快速检查它们的格式是否正确,但是当它返回字符串I时,会出现此错误:
Catchable fatal error: Argument 2 passed to myfunction() must be an instance of string, string given, called in path_to_file on line 69 and defined in path_to_file on line 49
例
function myfunction( array $ARRAY, string $STRING, int $INTEGER ) {
return "Args format correct";
}
myfunction(array("1",'2','3','4'), "test" , 1234);
错误在哪里?