PHP将每个Multidimensional数组的结果分开

时间:2016-08-16 09:27:27

标签: php multidimensional-array sum

我有从数据库生成的多维数组,并希望每个数组有一些itm2 + itm3,并得到多维数组的总数,如:

array 5 = 1740 array 6 = 2700

这是我的多维数组的一部分:

$arrays = Array
 (
  [5] => Array
    (
        [0] => stdClass Objectd(
                [itm1] => 19
                [itm2] => 500
                [itm3] => 100
            )

        [1] => stdClass Object(
                [itm1] => 20
                [itm2] => 700
                [itm3] => 100
            )

        [2] => stdClass Object(
                [itm1] => 21
                [itm2] => 240
                [itm3] => 100
            )
    )
  [6] => Array(
        [0] => stdClass Object(
                [itm1] => 22
                [itm2] => 1500
                [itm3] => 100
            )
        [1] => stdClass Object(
                [itm1] => 23
                [itm2] => 1000
                [itm3] => 100
            )
    )
 )

0 个答案:

没有答案