@param string $ipSubnet
@param int    $number

@return array
160777
public static function getSomeIpsFromRange($ipSubnet, $number = 3)
    {
        list($start, $end) = self::getIpRangeForSubnet($ipSubnet);

        $longStart = ip2long($start);
        $diff = ip2long($end) - $longStart;
        $parts = round($diff / ($number + 1));

        $ips = [];
        for ($x = 1; $x <= $number; $x++) {
            $ips[] = long2ip($longStart + ($parts * $x));
        }

        return $ips;
    }
880487
function buildRDSSubnetGroup(numZones = 0, { name = 'RDSSubnetGroup' } = {}) {
  if (numZones < 1) {
    return {};
  }

  const subnetIds = [];
  for (let i = 1; i <= numZones; i += 1) {
    subnetIds.push({ Ref: `${DB_SUBNET}Subnet${i}` });
  }

  return {
    [name]: {
      Type: 'AWS::RDS::DBSubnetGroup',
      Properties: {
        DBSubnetGroupName: {
          Ref: 'AWS::StackName',
        },
        DBSubnetGroupDescription: {
          Ref: 'AWS::StackName',
        },
        SubnetIds: subnetIds,
      },
    },
  };
}
1292469
private function readBIFF8CellRangeAddressList($subData)
    {
        $cellRangeAddresses = array();

        // offset: 0; size: 2; number of the following cell range addresses
        $nm = self::getInt2d($subData, 0);

        $offset = 2;
        // offset: 2; size: 8 * $nm; list of $nm (fixed) cell range addresses
        for ($i = 0; $i < $nm; ++$i) {
            $cellRangeAddresses[] = $this->readBIFF8CellRangeAddressFixed(substr($subData, $offset, 8));
            $offset += 8;
        }

        return array(
            'size' => 2 + 8 * $nm,
            'cellRangeAddresses' => $cellRangeAddresses,
        );
    }
253913
public function numberPermutations(int $number) {
        $result = [];
        $array = NumberUtil::intToArray($number);
        $result = $this->permute($array, "", $result);
        foreach ($result as &$item) {
            \settype($item, "integer");
        }
        return $result;
    }
261216
private function cidr6Match($ip, $range) {
        // Split CIDR on /
        list($subnet, $mask) = explode('/', $range);

        // Convert IP's to their in_addr representations
        $ip = inet_pton($ip);
        $subnet = inet_pton($subnet);

        // Convert the mask
        $mask = $this->getBinaryMask((int) $mask);

        return ($ip & $mask) === $subnet;
    }
69214
public function ntoa($nip)
	{
		$ip = [];
		for ($i = 3; $i > 0; $i --) {
			$ip_seg = intval($nip / pow(256, $i));
			$ip[] = $ip_seg;
			$nip -= $ip_seg * pow(256, $i);
		}
		$ip[] = $nip;
		return join('.', $ip);
	}
1228533
private function readBIFF5CellRangeAddressList($subData)
    {
        $cellRangeAddresses = array();

        // offset: 0; size: 2; number of the following cell range addresses
        $nm = self::getInt2d($subData, 0);

        $offset = 2;
        // offset: 2; size: 6 * $nm; list of $nm (fixed) cell range addresses
        for ($i = 0; $i < $nm; ++$i) {
            $cellRangeAddresses[] = $this->readBIFF5CellRangeAddressFixed(substr($subData, $offset, 6));
            $offset += 6;
        }

        return array(
            'size' => 2 + 6 * $nm,
            'cellRangeAddresses' => $cellRangeAddresses,
        );
    }
1001166
public function checkIP($ip)
    {
        $result = array();
        foreach ($this->getBlServers() as $blServer) {
            if ($blServer->supportIPv4()) {
                $result[] = $blServer->getResolver()->execute($ip);
            }
        }

        return $result;
    }
208236
public function getSubscriptionByNumber($number)
    {
        /** @var SubscriptionFbApi $response */
        $response = $this->call(new Request('subscription.get', array('subscription_number' => $number)), 'DVelopment\FastBill\Model\SubscriptionFbApi');
        $subscriptions = $response->getResponse()->getSubscriptions();

        return reset($subscriptions);
    }
782637
protected function _updateIp($time = 0, $number = 1) {
        $this->_ips[$this->_ip] = ['time' => $time, 'number' => $number];

        $this->_cache->setContent($this->_ips);
        $this->_cache->setCache();
    }
962667
public function addIssueLabels(int $number): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/issues/:number/labels',
            $this->getIssues()->getOwner(), $this->getIssues()->getRepo(), $number), Request::METHOD_POST);
    }
866975
public function getIp6array($ip){
      // expand - example: "2600:3c00::" ->  "2600:3c00:0000:0000:0000:0000:0000:0000"
      $hex = unpack("H*hex", inet_pton($ip));         
      $ipStr = substr(preg_replace("/([A-f0-9]{4})/", "$1:", $hex['hex']), 0, -1);
      
      $ipIntArray = array();
      $ipStrArray = explode(":", $ipStr);
      
      foreach ($ipStrArray as &$value) {
        $ipIntArray[] = hexdec($value);
      }
      
      return $ipIntArray;
    }
196438
public static function parseIPv4($input)
    {
        $parts = explode('.', $input);
        if ($parts[count($parts) - 1] === '') {
            array_pop($parts);
        }
        
        if ($parts === []) {
            $ipv4 = '';
        } elseif (count($parts) > 4) {
            $ipv4 = (string)$input;
        } else {
            $numbers = [];
            foreach ($parts as $i => $part) {
                if ($part === '') {
                    $ipv4 = (string)$input;
                    break;
                }
                $n = self::parseIPv4Number($part);
                if ($n === false) {
                    $ipv4 = (string)$input;
                    break;
                }
                if ($n > 255 && $i !== count($parts) - 1) {
                    $ipv4 = false;
                }
                $numbers[] = $n;
            }
            
            if (!isset($ipv4)) {
                $ipv4 = array_pop($numbers);
                if ($ipv4 >= pow(256, 4 - count($numbers))) {
                    $ipv4 = false;
                } else {
                    foreach ($numbers as $counter => $n) {
                        $ipv4 += $n * pow(256, 3 - $counter);
                    }
                }
            }
        }
        
        return $ipv4;
    }
6020
public function sendGetCipherKeysFromUser($numbers, $replaceKey = false)
    {
        if (!is_array($numbers)) {
            $numbers = [$numbers];
        }

        $this->replaceKey = $replaceKey;
        $msgId = $this->nodeId['cipherKeys'] = $this->createIqId();

        $userNode = [];
        foreach ($numbers as $number) {
            $userNode[] = new ProtocolNode('user',
              [
                  'jid' => $this->getJID($number),
              ], null, null);
        }
        $keyNode = new ProtocolNode('key', null, $userNode, null);
        $node = new ProtocolNode('iq',
            [
                'id'    => $msgId,
                'xmlns' => 'encrypt',
                'type'  => 'get',
                'to'    => Constants::WHATSAPP_SERVER,
            ], [$keyNode], null);

        $this->sendNode($node);
        $this->waitForServer($msgId);
    }
1109547
function isInSubnet(string $cidr): bool {
        list ($subnet, $bits) = explode('/', $cidr);
        $subnet = ip2long($subnet);
        $mask = - 1 << (32 - $bits);
        $subnet &= $mask; // nb: in case the supplied subnet wasn't correctly aligned
        return ($this->address & $mask) == $subnet;
    }
747331
public function convertToTriplets($number)
    {
        $triplets = [];

        while ($number > 0) {
            $triplets[] = $number % 1000;
            $number = (int) ($number / 1000);
        }

        return array_reverse($triplets);
    }
257439
private function calculateIpRange(int $cidrIpLong, int $cidrMask): array
    {
        $netWork = $cidrIpLong & $this->netMask($cidrMask);
        $lower   = $netWork + 1; // ignore network ID (eg: 192.168.1.0)
        $upper   = ($netWork | $this->inverseNetMask($cidrMask)) - 1 ; //  ignore broadcast IP (eg: 192.168.1.255)
        return array($lower, $upper);
    }