in reply to List of Numbers

If it's no coincidence that 15 gets mapped to 1, 20 to 2, etc, i.e. all multiples of some number and the corresponding values increasing, then you could view the problem a little differently. There's a linear relation between (15, 1), (20, 2), (25, 3),... which can be expressed by y = x/5 - 2. All values you give satisfy this equation as can be verified easily.

Now we can compute the corresponding number for $x simply as:

$number = ceil($x/5 - 2);

Hope this helps, -gjb-

Replies are listed 'Best First'.
Re: Re: List of Numbers
by Anonymous Monk on Jan 18, 2003 at 20:36 UTC
    Sorry I was just using 15,20,25 as examples. Any number could populate the hash and the resulting value in the hash could be anything as well.