title: repeat items in a php array until they match the count of another array
body: <p>I've created two arrays from strings using <code>explode()</code> one called <code>$labels</code> and the other called <code>$colors</code>. What I'd like to do is check the count of the items in <code>$labels</code> and if there are less items in <code>$colors</code> I'd like the values of the <code>$colors</code> array to be repeated until the count matches. If there are more items in <code>$colors</code> than in <code>$labels</code> I'd like to reduce remove items from the <code>$colors</code> array until it matches the number of items in <code>$labels</code>.</p>
  
  <p>I assume I can use <code>count()</code> or <code>array_legnth()</code> in a conditional to compare the number of items between the two arrays and that I'm going to have to use some kind of while loop but really not sure how to get started.</p>
  
  <p>Is there a better way or function I should use to compare the two arrays? And how would I go about repeating or deleting the items in the second array so that I land up with the same number of items in each?</p>