Blogger Information
Blog 23
fans 0
comment 0
visits 13492
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
20190928 作业
王长中的博客
Original
478 people have browsed it

实例

function func(...$d)
{
    $x=1;
    foreach($d as $v){
        $x*=$v;
    }
    return $x;
}
echo func(100,2,5)

运行实例 »

点击 "运行实例" 按钮查看在线实例

总结:

         剩余参数是php7新增的一个特性,它可以将传入函数的参数打包成一个数组,我们对数组循环,可以得到结果。

Correction status:qualified

Teacher's comments:$params是php7新增的一个特性? 是剩余参数
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!