/** * Determines whether the specified IP is inside the range * * @return boolean */ function contains(IP $ip) { $mask = $this->to->equals($this->from) ? $this->to->toInt() : 0xffffffff << 32 - $this->to->toInt(); return ($ip->toInt() & $mask) == ($this->from->toInt() & $mask); }