如何总结所有的数字在PHP中的数组 [英] How to sum up all the numbers in an array in php

查看:154
本文介绍了如何总结所有的数字在PHP中的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好人请我真的需要你的帮助,尽快,我有一个计算的津贴,并把它们放入数组的功能。我想总结一下该阵列中所有的数字并把它放在一个变量。退房code以下具有排列

  //计算工资分解成选项
    $ salary_breakdown =自:: calc_salary_options($ gross_salary,$ branch_id / *,$ pay_band_id * /);    //存储密钥
    如果(is_array($ salary_breakdown))
        $这个 - > optionKeys = array_keys($ salary_breakdown);


解决方案

阵列总和PHP,它可以帮助你。

  array_sum

http://php.net/manual/en/function.array- sum.php

Hello guy pls i really need your help asap, i have a function that calculates allowances and puts them in an array. i want to sum up all the numbers in that array and put it in a variable. Check out the code below that has the array

// Calculate the salary breakdown into the options
    $salary_breakdown = self::calc_salary_options($gross_salary,$branch_id/*,$pay_band_id*/);

    // Store the keys
    if (is_array($salary_breakdown))
        $this->optionKeys = array_keys($salary_breakdown);

解决方案

Array sum php,It may help you.

array_sum

http://php.net/manual/en/function.array-sum.php

这篇关于如何总结所有的数字在PHP中的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆