public static function getDomain($emails): array
    {
        $result = [];

        if (empty($emails)) {
            return $result;
        }

        $emails = self::handleEmailsInput($emails);

        foreach ($emails as $email) {
            if (!self::isValid($email)) {
                continue;
            }

            $domain = self::extractDomain($email);
            if (!empty($domain) && !in_array($domain, $result, true)) {
                $result[] = $domain;
            }
        }

        return $result;
    }
public static function getDomain($emails): array
    {
        $result = [];

        if (empty($emails)) {
            return $result;
        }

        $emails = self::handleEmailsInput($emails);

        foreach ($emails as $email) {
            if (!self::isValid($email)) {
                continue;
            }

            $domain = self::extractDomain($email);
            if (!empty($domain) && !in_array($domain, $result, true)) {
                $result[] = $domain;
            }
        }

        return $result;
    }
public static function getDomain ( $ emails ) : array { $ result = [ ] ; if ( empty ( $ emails ) ) { return $ result ; } $ emails = self :: handleEmailsInput ( $ emails ) ; foreach ( $ emails as $ email ) { if ( ! self :: isValid ( $ email ) ) { continue ; } $ domain = self :: extractDomain ( $ email ) ; if ( ! empty ( $ domain ) && ! in_array ( $ domain , $ result , true ) ) { $ result [ ] = $ domain ; } } return $ result ; }
Get domains from email addresses. The not valid email addresses
will be skipped.

@param string|array $emails
@return array
Get domains from email addresses . The not valid email addresses will be skipped .