title: php - making calculations for every combination in array
body: <p>I have this array with teams that are in a competition, now i want to do some calculations for each match that is going to happen.  </p>
  
  <pre><code>Array
  (
      [Team1] =&gt; Array
          (
              [totalHomeGoals] =&gt; 48
              [totalHomeAgainstGoals] =&gt; 12
              [totalAwayGoals] =&gt; 31
              [totalAwayAgainstGoals] =&gt; 11
          )
  
      [Team2] =&gt; Array
          (
              [totalHomeGoals] =&gt; 31
              [totalHomeAgainstGoals] =&gt; 25
              [totalAwayGoals] =&gt; 25
              [totalAwayAgainstGoals] =&gt; 27
          )
  
      [Team3] =&gt; Array
          (
              [totalHomeGoals] =&gt; 22
              [totalHomeAgainstGoals] =&gt; 21
              [totalAwayGoals] =&gt; 15
              [totalAwayAgainstGoals] =&gt; 38
          )
  )
  </code></pre>
  
  <p>So now i want to make calculations for each possible match. To make it simple let's  say i want to add the AwayGoals to the Homegoals, so like this:</p>
  
  <pre><code>Team1 vs Team2 -&gt; 48 + 25  
  Team2 vs Team1 -&gt; 31 + 31  
  Team1 vs Team3 -&gt; 48 + 15  
  Team3 vs Team1 -&gt; 22 + 31  
  Team2 vs Team3 -&gt; 31 + 15  
  </code></pre>
  
  <p>etc<br>
  etc for all 12 possible matches</p>
  
  <p>What direction should i look to accomplish this? </p>