Grammar errors for beginners: syntax error, unexpected ':', expecting '
袁生
袁生 2020-06-09 09:24:47
0
3
3340

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

袁生
袁生

reply all(2)
林夕丶

What did you write? It’s all wrong

痴心易碎

...nums

What is this

  • reply Yes, delete this and it will be fine, thank you.
    袁生 author 2020-06-09 15:19:38
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!