title: Double Foreach unexpected result
body: <p>I have two arrays, both associative;</p>
  
  <pre><code>ArrayUneaten ( lemon=&gt; 7, banana=&gt;6, apple=&gt;10)//the units of UNeaten fruit
  ArrayOrdered (lemon =&gt;10, strawberry =&gt;10, Kiwi=&gt;0, Apple=&gt;20, Banana=&gt;6) // the units of ordered fruit
  </code></pre>
  
  <p>I want to create a third array (numeric is fine if in the same order as ArrayOrdered) 
  of all fruit options and the % of Fruit Eaten (compared to Fruit Ordered). </p>
  
  <p>(NB for other reasons if Ordered Value = 0, %eaten = 0%)</p>
  
  <p>(NB2, note that % desired for strawberries is 100, no strawberries are uneaten, 10 ordered, therefore 10 have been eaten)</p>
  
  <p>So desired Array</p>
  
  <pre><code>ArrayEatenPercentage (70, 100, 0, 50, 0)
  </code></pre>
  
  <p>My coding attempt</p>
  
  <pre><code>$CompletedPercentagesArray = array ();
  
  foreach( $ArrayOrdered as $fruitOrdered =&gt; $unitsOrdered) {
      if ($unitsOrdered == 0){
          //if it's zero it's never been selected
          $completedPercentage = 0;
      }
      foreach( $ArrayUneaten as $fruitUneaten =&gt; $unitsUneaten) {
          if ( $fruitUneaten == $fruitOrdered){
              // ($totalCardsChosen = $timesSelected*25; - please ignore)
              $percentageUneaten = 100*($fruitUneaten/$unitsOrdered);
              $percentageEaten = 100 - $percentageUneaten;
              $completedPercentage = round ($percentageEaten, 1);
          }
          else {//if this is true then it's been selected and been finished
              $completedPercentage = 100;
          }
      }
      array_push( $completedPercentagesArray, $completedPercentage ); //this adds the variable to the array
  }
  print_r($completedPercentagesArray);
  </code></pre>
  
  <p>Current output is unexpected. </p>
  
  <p>Only last value of ArrayUneaten is processed correctly. </p>
  
  <p>The other values return 100%.</p>
  
  <pre><code>ArrayEatenPercentage (100, 100, 100, 50, 100)
  </code></pre>