您的位置:首页技术文章
文章详情页

新手入门语法错误:syntax error, unexpected ’:’, expecting ’

【字号: 日期:2022-06-04 18:26:56浏览:86作者:猪猪

问题描述

function sum(int ...$nums)

{

return array_sum($nums);

}

try {

echo sum(...nums:1,2,3,5); //这句报错,不知那里的问题。

} catch (Throwable $th) {

echo $th->getMessage();

}

Parse error: syntax error, unexpected ':', expecting ')' in D:phpstudy_proWWWyhj.php on line 52

问题解答

回答1:

你这个写的是个啥 全是错误啊

回答2:

...nums

这个是什么东西