php checking for total classes within range