我正在尝试创建一个带有声明参数类型的函数,以便快速检查它们是否处于正确的格式,但当它返回一个字符串时,我会遇到这个错误:
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);
哪里出错了?