批改状态:合格
老师批语:写得正确
<?php
function sum( $a,$b,$c,...$d)
{
array_push($d,$a,$b,$c);
return array_product($d);
}
echo sum(1,2,3,4,5,6);
?>点击 "运行实例" 按钮查看在线实例
function是php函数 sum是用户自定义的函数名称
array_push运行函数 函数第一个为数组,后面为值
array_product 计算数组中所有值的乘积
测试结果为720
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号