You are here

private function IpAddress::packIp4 in IP address fields 8

Same name and namespace in other branches
  1. 2.0.x src/IpAddress.php \Drupal\field_ipaddress\IpAddress::packIp4()

Strips leading zeros and converts an IPv4 to its binary representation.

File

src/IpAddress.php, line 259

Class

IpAddress
IpTools class.

Namespace

Drupal\field_ipaddress

Code

private function packIp4($ip) {
  return inet_pton(preg_replace('/\\b0+(?=\\d)/', '', $ip));
}