Summary array elements in php

I am beginner in PHP.

I have an array containing different data.

I have this array:

$array = Array
(
    [day0] => Array
        (
            [0] => Array
                (
                    [dayName] => Czwartek, 2020-01-16
                    [Dishes] => Array
                        (
                            [0] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 1
                                            [name] => Danie dnia
                                            [items] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [id] => 7
                                                            [name] => Mleko kobiece
                                                            [quantity] => 0.32
                                                            [quantityBrutto] => 0.35
                                                        )

                                                    [1] => Array
                                                        (
                                                            [id] => 395
                                                            [name] => Płatki gryczane
                                                            [quantity] => 10.00
                                                            [quantityBrutto] => 10
                                                        )

                                                    [2] => Array
                                                        (
                                                            [id] => 811
                                                            [name] => Zupa fasolowa
                                                            [quantity] => 1.20
                                                            [quantityBrutto] => 1.2
                                                        )

                                                    [3] => Array
                                                        (
                                                            [id] => 815
                                                            [name] => Zupa grzybowa zabielana
                                                            [quantity] => 2.20
                                                            [quantityBrutto] => 2.2
                                                        )

                                                    [4] => Array
                                                        (
                                                            [id] => 842
                                                            [name] => Dorsz, filety gotowane na parze
                                                            [quantity] => 150.20
                                                            [quantityBrutto] => 150.2
                                                        )

                                                    [5] => Array
                                                        (
                                                            [id] => 196
                                                            [name] => Dorsz, świeży, filety bez skóry
                                                            [quantity] => 180.00
                                                            [quantityBrutto] => 180
                                                        )

                                                    [6] => Array
                                                        (
                                                            [id] => 1021
                                                            [name] => Ziemniaki purée
                                                            [quantity] => 220.00
                                                            [quantityBrutto] => 220
                                                        )

                                                    [7] => Array
                                                        (
                                                            [id] => 1035
                                                            [name] => Kompot z jabłek, z cukrem
                                                            [quantity] => 10.00
                                                            [quantityBrutto] => 10
                                                        )

                                                )

                                        )

                                    [1] => Array
                                        (
                                            [id] => 1
                                            [name] => Danie dnia
                                            [items] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [id] => 7
                                                            [name] => Mleko kobiece
                                                            [quantity] => 0.32
                                                            [quantityBrutto] => 0.35
                                                        )

                                                    [1] => Array
                                                        (
                                                            [id] => 395
                                                            [name] => Płatki gryczane
                                                            [quantity] => 10.00
                                                            [quantityBrutto] => 10
                                                        )

                                                    [2] => Array
                                                        (
                                                            [id] => 811
                                                            [name] => Zupa fasolowa
                                                            [quantity] => 1.20
                                                            [quantityBrutto] => 1.2
                                                        )

                                                    [3] => Array
                                                        (
                                                            [id] => 815
                                                            [name] => Zupa grzybowa zabielana
                                                            [quantity] => 2.20
                                                            [quantityBrutto] => 2.2
                                                        )

                                                    [4] => Array
                                                        (
                                                            [id] => 842
                                                            [name] => Dorsz, filety gotowane na parze
                                                            [quantity] => 150.20
                                                            [quantityBrutto] => 150.2
                                                        )

                                                    [5] => Array
                                                        (
                                                            [id] => 196
                                                            [name] => Dorsz, świeży, filety bez skóry
                                                            [quantity] => 180.00
                                                            [quantityBrutto] => 180
                                                        )

                                                    [6] => Array
                                                        (
                                                            [id] => 1021
                                                            [name] => Ziemniaki purée
                                                            [quantity] => 220.00
                                                            [quantityBrutto] => 220
                                                        )

                                                    [7] => Array
                                                        (
                                                            [id] => 1035
                                                            [name] => Kompot z jabłek, z cukrem
                                                            [quantity] => 10.00
                                                            [quantityBrutto] => 10
                                                        )

                                                )

                                        )

                                    [2] => Array
                                        (
                                            [id] => 3
                                            [name] => Kotlet
                                            [items] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [id] => 947
                                                            [name] => Surówka wielowarzywna z jogurtem naturalnym 2% tłuszczu
                                                            [quantity] => 50.00
                                                            [quantityBrutto] => 50
                                                        )

                                                    [1] => Array
                                                        (
                                                            [id] => 491
                                                            [name] => Ziemniaki, mrożone
                                                            [quantity] => 50.00
                                                            [quantityBrutto] => 50
                                                        )

                                                    [2] => Array
                                                        (
                                                            [id] => 887
                                                            [name] => Kotlet schabowy panierowany, smażony
                                                            [quantity] => 180.00
                                                            [quantityBrutto] => 180
                                                        )

                                                )

                                        )

                                )

                        )

                )

        )

    [day1] => Array
        (
            [1] => Array
                (
                    [dayName] => Piątek, 2020-01-17
                    [Dishes] => Array
                        (
                            [1] => Array
                                (
                                    [0] => Array
                                        (
                                            [id] => 1
                                            [name] => Danie dnia
                                            [items] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [id] => 7
                                                            [name] => Mleko kobiece
                                                            [quantity] => 0.32
                                                            [quantityBrutto] => 0.35
                                                        )

                                                    [1] => Array
                                                        (
                                                            [id] => 395
                                                            [name] => Płatki gryczane
                                                            [quantity] => 10.00
                                                            [quantityBrutto] => 10
                                                        )

                                                    [2] => Array
                                                        (
                                                            [id] => 811
                                                            [name] => Zupa fasolowa
                                                            [quantity] => 1.20
                                                            [quantityBrutto] => 1.2
                                                        )

                                                    [3] => Array
                                                        (
                                                            [id] => 815
                                                            [name] => Zupa grzybowa zabielana
                                                            [quantity] => 2.20
                                                            [quantityBrutto] => 2.2
                                                        )

                                                    [4] => Array
                                                        (
                                                            [id] => 842
                                                            [name] => Dorsz, filety gotowane na parze
                                                            [quantity] => 150.20
                                                            [quantityBrutto] => 150.2
                                                        )

                                                    [5] => Array
                                                        (
                                                            [id] => 196
                                                            [name] => Dorsz, świeży, filety bez skóry
                                                            [quantity] => 180.00
                                                            [quantityBrutto] => 180
                                                        )

                                                    [6] => Array
                                                        (
                                                            [id] => 1021
                                                            [name] => Ziemniaki purée
                                                            [quantity] => 220.00
                                                            [quantityBrutto] => 220
                                                        )

                                                    [7] => Array
                                                        (
                                                            [id] => 1035
                                                            [name] => Kompot z jabłek, z cukrem
                                                            [quantity] => 10.00
                                                            [quantityBrutto] => 10
                                                        )

                                                )

                                        )

                                )

                        )

                )

        )

    [day2] => Array
        (
            [2] => Array
                (
                    [dayName] => Sobota, 2020-01-18
                )

        )

    [day3] => Array
        (
            [3] => Array
                (
                    [dayName] => Niedziela, 2020-01-19
                )

        )


)

I need to get this result:

Czwartek, 2020-01-16

  • Mleko kobiece = sum of all "Mleko kobiece" / id = 7 from Thursday, 2020-01-16

  • Płatki gryczane = sum of all "Płatki gryczane" / id = 395 from Thursday, 2020-01-16

  • Zupa fasolowa = sum of all "Zupa fasolowa" / id = 811 from Thursday, 2020-01-16

  • Dorsz, filety gotowane na parze = sum of all "Dorsz, filety gotowane na parze" / id = 842 from Thursday, 2020-01-16

etc I need summary by quantityBrutto.

I need to display a shopping list from this array and displaying the dish and its sum once each day.

How can I make it?