dimanche 12 juillet 2020

get elements sum from array Laravel

i have an array that contains another array and i wanna get specifics elements sum

Array

    array:1 [▼
  0 => array:3 [▼
    "shop_id" => 1
    "delegate_id" => 2
    "items" => array:3 [▼
      0 => array:3 [▼
        "product_id" => 2
        "price" => 4.75
        "quantity" => 1
      ]
      1 => array:3 [▼
        "product_id" => 6
        "price" => 18.5
        "quantity" => 1
      ]
      2 => array:3 [▼
        "product_id" => 10
        "price" => 88
        "quantity" => 2
      ]
    ]
  ]
]

i need to get the sum of price

any ideas to do this?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2AS4HbL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire