How can I total a multidimensional array

I have an array that contains this:
[php]array(140) {
[“VictorRobinsonThe Globe (Weds)”]=> array(8) { [1]=> string(6) “Victor”
[2]=> string(8) “Robinson”
[3]=> string(16) “The Globe (Weds)”
[4]=> int(6)
[5]=> int(6)
[6]=> int(12)
[7]=> int(3)
[8]=> float(435) }
“NickWhiteThe Globe (Weds)”]=> array(8) { [1]=> string(4) “Nick”
[2]=> string(5) “White”
[3]=> string(16) “The Globe (Weds)”
[4]=> int(6)
[5]=> int(6)
[6]=> int(12)
[7]=> int(3)
[8]=> float(435) }
[“GeoffSteeleThe Globe (Mon)”]=> array(8) { [1]=> string(5) “Geoff”
[2]=> string(6) “Steele”
[3]=> string(15) “The Globe (Mon)”
[4]=> int(2)
[5]=> int(2)
[6]=> int(4)
[7]=> int(1)
[8]=> float(108) }
[“GeoffSteeleThe Globe (Weds)”]=> array(8) { [1]=> string(5) “Geoff”
[2]=> string(6) “Steele”
[3]=> string(16) “The Globe (Weds)”
[4]=> int(4)
[5]=> int(26)
[6]=> int(30)
[7]=> int(2)
[8]=> float(1086) }
[“JamieLaneThe Crown”]=> array(8) { [1]=> string(5) “Jamie”
[2]=> string(4) “Lane”
[3]=> string(9) “The Crown”
[4]=> int(5)
[5]=> int(88)
[6]=> int(93)
[7]=> int(3)
[8]=> float(2019) }
[“JamieLaneThe Globe (Mon)”]=> array(8) { [1]=> string(5) “Jamie”
[2]=> string(4) “Lane”
[3]=> string(15) “The Globe (Mon)”
[4]=> int(4)
[5]=> int(36)
[6]=> int(40)
[7]=> int(2)
[8]=> float(1080) }
[“JamieLaneThe Globe (Weds)”]=> array(8) { [1]=> string(5) “Jamie”
[2]=> string(4) “Lane”
[3]=> string(16) “The Globe (Weds)”
[4]=> int(6)
[5]=> int(64)
[6]=> int(70)
[7]=> int(3)
[8]=> float(2534) }
[“PhillipEmmersonThe Crown”]=> array(8) { [1]=> string(7) “Phillip”
[2]=> string(8) “Emmerson”
[3]=> string(9) “The Crown”
[4]=> int(6)
[5]=> int(36)
[6]=> int(42)
[7]=> int(3)
[8]=> float(912) }[/php]

What I want to do is subtotal on key[7]. in the above example the var_dump shows this:
[php]- Victor Robinson 3 -

  • Nick White 3 -
  • Geoff Steele 1 -
  • Geoff Steele 2 -
  • Jamie Lane 3 -
  • Jamie Lane 2 -
  • Jamie Lane 3 -
  • Phillip Emmerson 3 - [/php]

I’d like the names that appear multiple times to added together so it looks like this:
[php]- Victor Robinson 3 -

  • Nick White 3 -
  • Geoff Steele 3 -
  • Jamie Lane 8 -
  • Phillip Emmerson 3 - [/php]

Any help would be greatly appreciated :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service