public static function expandIpv6(string $ip): string
    {
        if (!Validator::ipv6($ip)) {
            throw new \InvalidArgumentException(sprintf('"%s" is not a valid IPv6 address.', $ip));
        }

        $hex = unpack('H*hex', inet_pton($ip));

        return implode(':', str_split($hex['hex'], 4));
    }
public static function expandIpv6(string $ip): string
    {
        if (!Validator::ipv6($ip)) {
            throw new \InvalidArgumentException(sprintf('"%s" is not a valid IPv6 address.', $ip));
        }

        $hex = unpack('H*hex', inet_pton($ip));

        return implode(':', str_split($hex['hex'], 4));
    }
public static function expandIpv6 ( string $ ip ) : string { if ( ! Validator :: ipv6 ( $ ip ) ) { throw new \ InvalidArgumentException ( sprintf ( '"%s" is not a valid IPv6 address.' , $ ip ) ) ; } $ hex = unpack ( 'H*hex' , inet_pton ( $ ip ) ) ; return implode ( ':' , str_split ( $ hex [ 'hex' ] , 4 ) ) ; }
Expands an IPv6 address to its full, non-shorthand representation.

E.g. 2001:db8:9a::42 -> 2001:0db8:009a:0000:0000:0000:0000:0042

@param string $ip IPv6 address

@throws \InvalidArgumentException

@return string
Expands an IPv6 address to its full non - shorthand representation .