private function expandIPv6($ip) { $hex = unpack('H*hex', inet_pton($ip)); return substr(preg_replace('/([a-f0-9]{4})/i', '$1:', $hex['hex']), 0, -1); }