0

I just have no idea how to sum and echo values in multidimensional array. This is my array with info about order.

I need to sum RESULT_VALUE and echo one united DESCR list. I have tried lots of things but nothing, never worked with that kind of arrays levels. This is an array with two different products with applied discounts.

Array
(
    [0] => Array
        (
            [ORDER_ID] => 35
            [DISCOUNT_ID] => 18
            [ORDER_COUPON_ID] => 0
            [COUPON_ID] => 
            [RESULT] => Array
                (
                    [BASKET] => Array
                        (
                            [617] => Array
                                (
                                    [RULE_ID] => 248
                                    [APPLY] => Y
                                    [RULE_DESCR_ID] => 248
                                    [ACTION_BLOCK_LIST] => Array
                                        (
                                            [0] => 0
                                        )

                                    [DESCR_DATA] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [TYPE] => 2
                                                    [VALUE] => 10
                                                    [VALUE_TYPE] => P
                                                    [VALUE_ACTION] => D
                                                    [RESULT_VALUE] => 229.905
                                                    [RESULT_UNIT] => RUB
                                                )

                                        )

                                    [DESCR] => Array
                                        (
                                            [0] => discount 10% (229.91 rub.)
                                        )

                                    [DESCR_ID] => 248
                                    [BASKET_ID] => 617
                                    [MODULE] => catalog
                                    [PRODUCT_ID] => 10109
                                )

                            [618] => Array
                                (
                                    [RULE_ID] => 249
                                    [APPLY] => Y
                                    [RULE_DESCR_ID] => 249
                                    [ACTION_BLOCK_LIST] => Array
                                        (
                                            [0] => 0
                                        )

                                    [DESCR_DATA] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [TYPE] => 2
                                                    [VALUE] => 10
                                                    [VALUE_TYPE] => P
                                                    [VALUE_ACTION] => D
                                                    [RESULT_VALUE] => 70.796
                                                    [RESULT_UNIT] => RUB
                                                )

                                        )

                                    [DESCR] => Array
                                        (
                                            [0] => discount 10% (70.80 rub.)
                                        )

                                    [DESCR_ID] => 249
                                    [BASKET_ID] => 618
                                    [MODULE] => catalog
                                    [PRODUCT_ID] => 10054
                                )

                        )

                )

            [ACTION_BLOCK_LIST] => 1
        )
Cœur
  • 37,241
  • 25
  • 195
  • 267
Hazzy
  • 43
  • 4
  • _I have tried lots of things but nothing, never worked_ Did you? There are numerous similar questions here on SO: [question 1](https://stackoverflow.com/questions/27053492/sum-the-values-of-two-associative-multi-dimensional-arrays-in-php), [question 2](https://stackoverflow.com/questions/16138395/sum-values-of-multidimensional-array-by-key-without-loop), [question 3](https://stackoverflow.com/questions/5821948/in-php-find-duplicate-entry-in-a-multi-dimensional-array-then-sum-the-values-in) – KarelG Feb 01 '18 at 12:21
  • 1
    What do you mean with *echo one united DESCR list* there is no key in the array with only "DESCR" or "DESCR list" – Andreas Feb 01 '18 at 12:23
  • @Andreas, I mean I need to echo cell with key DESCR and it should look like this:
  • discount 10%....
  • discount 10%....
  • – Hazzy Feb 01 '18 at 12:43