You are here

private function Database::readIp in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 includes/vendor/ip2location/ip2location-php/IP2Location.php \IP2Location\Database::readIp()

High level fucntion to read an IP address of the given version

@access private

Parameters

int $version IP version to read (either 4 or 6, returns false on anything else):

int $pos Position to read from:

Return value

int|string|boolean

1 call to Database::readIp()
Database::binSearch in includes/vendor/ip2location/ip2location-php/IP2Location.php
Perform a binary search on the given IP number and return a pointer to its record

File

includes/vendor/ip2location/ip2location-php/IP2Location.php, line 1451

Class

Database
IP2Location database class

Namespace

IP2Location

Code

private function readIp($version, $pos) {
  if (4 === $version) {

    // Read a standard PHP int
    return self::wrap32($this
      ->readWord($pos));
  }
  elseif (6 === $version) {

    // Read as BCMath int (quad)
    return $this
      ->readQuad($pos);
  }
  else {

    // unrecognized
    return false;
  }
}