function sum(int ...$nums)
{
return array_sum($nums);
}
try {
echo sum(...nums:1,2,3,5); //This error is reported, I don’t know what the problem is.
} catch (\Throwable $th) {
echo $th->getMessage();
}
Parse error: syntax error, unexpected ':', expecting ')' in D:\phpstudy_pro\WWW\yhj.php on line 52
What did you write? It’s all wrong
...nums
What is this