IP2Location.php
private static function ipBetween($version, $ip, $low, $high) {
    if (4 === $version) {
      // Use normal PHP ints
      if ($low <= $ip) {
        if ($ip < $high) {
          return 0;
        } else {
          return 1;
        }
      } else {
        return -1;
      }
    } else {
      // Use BCMath
      if (bccomp($low, $ip, 0) <= 0) {
        if (bccomp($ip, $high, 0) <= -1) {
          return 0;
        } else {
          return 1;
        }
      } else {
        return -1;
      }
    }
  }
private static function ipBetween($version, $ip, $low, $high) {
    if (4 === $version) {
      // Use normal PHP ints
      if ($low <= $ip) {
        if ($ip < $high) {
          return 0;
        } else {
          return 1;
        }
      } else {
        return -1;
      }
    } else {
      // Use BCMath
      if (bccomp($low, $ip, 0) <= 0) {
        if (bccomp($ip, $high, 0) <= -1) {
          return 0;
        } else {
          return 1;
        }
      } else {
        return -1;
      }
    }
  }
private static function ipBetween ( $ version , $ ip , $ low , $ high ) { if ( 4 === $ version ) { // Use normal PHP ints if ( $ low <= $ ip ) { if ( $ ip < $ high ) { return 0 ; } else { return 1 ; } } else { return - 1 ; } } else { // Use BCMath if ( bccomp ( $ low , $ ip , 0 ) <= 0 ) { if ( bccomp ( $ ip , $ high , 0 ) <= - 1 ) { return 0 ; } else { return 1 ; } } else { return - 1 ; } } }
Determine whether the given IP number of the given version lies between the given bounds

This function will return 0 if the given ip number falls within the given bounds
for the given version, -1 if it falls below, and 1 if it falls above.

@access private
@static
@param int $version  IP version to use (either 4 or 6)
@param int|string $ip  IP number to check (int for IPv4, string for IPv6)
@param int|string $low  Lower bound (int for IPv4, string for IPv6)
@param int|string $high  Uppoer bound (int for IPv4, string for IPv6)
@return int
Determine whether the given IP number of the given version lies between the given bounds