Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jak sumować w takiej tablicy wielowymiarowej?
majma
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 12.11.2008

Ostrzeżenie: (0%)
-----


Mam taką tablicę:
  1. <?php
  2. (
  3.    [0] => Array
  4.        (
  5.            [ownerid] => 100073
  6.            [shipping] => 10
  7.        )
  8.  
  9.    [1] => Array
  10.        (
  11.            [ownerid] => 107266
  12.            [shipping] => 20
  13.        )
  14.  
  15.    [2] => Array
  16.        (
  17.            [ownerid] => 107266
  18.            [shipping] => 35
  19.        )
  20.  
  21.    [3] => Array
  22.        (
  23.            [ownerid] => 100073
  24.            [shipping] => 40
  25.        )
  26.   [4] => Array
  27.        (
  28.            [ownerid] => 123456
  29.            [shipping] => 80
  30.        )
  31. )
  32. ?>


Chciałbym zsumować 'shipping' dla każdego 'ownerid', czyli potrzebuję rezultat:
  1. <?php
  2. (
  3.    [0] => Array
  4.        (
  5.            [ownerid] => 100073
  6.            [shipping] => 50
  7.        )
  8.  
  9.    [1] => Array
  10.        (
  11.            [ownerid] => 107266
  12.            [shipping] => 55
  13.        )
  14.   [2] => Array
  15.        (
  16.            [ownerid] => 123456
  17.            [shipping] => 80
  18.        )
  19. )
  20. ?>


Potrafiłby ktoś mi pomóc?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 17:19