Please forgive my title because I have no idea how to explain it.
Basically, I have arrays that can have up to 40 keys (all coincidentally with a unique value of 1-40).
All keys need to retain its position. But the values need to be renumbered from "1" to "the total number of keys within the array" but retaining its relative position.)
This array:
$a = array(1,5,16,7,4)
would be converted to a new array of:
$b = array(1,3,5,4,2)
*Relative - As you can see, 16 changes to 5, but is still the highest number within the array, with 7 changing to 4 and so on.
This has been driving me nuts all day. I've used while loops and all sorts of things, and I just can't get it to work.