PHP how to invert a scale of numbers
<p>Say I have a dataset, each element has an associated "score".</p>

<p>eg:<br>
Banana - 5<br>
Apple - 3<br>
Pear - 2  </p>

<p>I want to invert the scale so that :<br>
All 5's become 1's<br>
All 4's become 2's<br>
All 3's become 3's<br>
All 2's become 4's<br>
All 1's become 5's  </p>

<p>So I'd end up with<br>
Banana - 1<br>
Apple - 3<br>
Pear - 4  </p>

<p>I'm struggling to find a graceful solution that doesn't involve creating a map.</p>
