Blogger Information
Blog 18
fans 0
comment 0
visits 20163
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
使用剩余参数实现不定参数的累乘
葛佬的博客
Original
940 people have browsed it

使用array_product()方法可以实现数组成员的累乘。前提要求成员均为数值类型。

实例

<?php
function multiplication(...$params)
{
    return array_product($params);
}

echo multiplication(1,2,3,4,5);

运行实例 »

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

 

Correction status:qualified

Teacher's comments:总结忘了写了
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