Note that Joey's code showing an example of using InvalidArgumentException uses is_int, but probably should use filter_var($int, FILTER_VALIDATE_INT).
Also, whether you should throw this function or OutOfRangeException when dealing with arrays is a bit unclear. My personal preference is to throw InvalidArgumentException.