Ok. Well, I'm not sure I have a clue as to what your trying to accomplish, but lets look at a way to solve the particular problem.
I'm going to assume the "values" that you mention are held in an array $pages. What we are trying to find is an equation where x = 1 when pages is between 1 and 25, x = 2 when pages is between 26 and 50 and so on. The easiest way to find this is by dividing and taking the ceil() of that number (rounds up to nearest int). So -
$new_array[ceil($pages / 25)] = $pages;
Would put the value that was in $pages into the correct element of the array that you requested. I hope that helps!
Chris King