If only the problem were that simple. I can manage both of those.
What I need to do is the following: (I didn't think I'd explained it well enough first time round.)
Example:
$relay_ip = "62.49.139.88";
Assuming there are 4 hits for this IP, and 2 for 62.49.139.55 already,
A cidr check on this for a /32 will reveal 4 matches.
A cidr check on this for a /24 will reveal 6 matches, and so on.
What I need is (ideally) an array which will return the following:
$cidr_results[0] = 4 //32
$cidr_results[1] = 6 //24
and so one thru the array for a /32, /24, /21, etc.
Does that make more sense? If you don't understand how CIDR conotations works, that probably won't make sense.