protected function _validateDomain($domain)
    {
        // Note the different use of $subdomains and $sub_domains
        $subdomains = explode('.', $domain);

        while (count($subdomains) > 0) {
            $sub_domains[] = $this->_splitCheck($subdomains, '.');
            for ($i = 0; $i < $this->index + 1; $i++)
                array_shift($subdomains);
        }

        foreach ($sub_domains as $sub_domain) {
            if (!$this->_validateSubdomain(trim($sub_domain)))
                return false;
        }

        // Managed to get here, so return input.
        return $domain;
    }
protected function _validateDomain($domain)
    {
        // Note the different use of $subdomains and $sub_domains
        $subdomains = explode('.', $domain);

        while (count($subdomains) > 0) {
            $sub_domains[] = $this->_splitCheck($subdomains, '.');
            for ($i = 0; $i < $this->index + 1; $i++)
                array_shift($subdomains);
        }

        foreach ($sub_domains as $sub_domain) {
            if (!$this->_validateSubdomain(trim($sub_domain)))
                return false;
        }

        // Managed to get here, so return input.
        return $domain;
    }
protected function _validateDomain ( $ domain ) { // Note the different use of $subdomains and $sub_domains $ subdomains = explode ( '.' , $ domain ) ; while ( count ( $ subdomains ) > 0 ) { $ sub_domains [ ] = $ this -> _splitCheck ( $ subdomains , '.' ) ; for ( $ i = 0 ; $ i < $ this -> index + 1 ; $ i ++ ) array_shift ( $ subdomains ) ; } foreach ( $ sub_domains as $ sub_domain ) { if ( ! $ this -> _validateSubdomain ( trim ( $ sub_domain ) ) ) return false ; } // Managed to get here, so return input. return $ domain ; }
Function to validate a domain, though this is not quite what
you expect of a strict internet domain.

domain = sub-domain *("." sub-domain)

@param string $domain The string to check.
@return mixed False on failure, or the validated domain on success.
Function to validate a domain though this is not quite what you expect of a strict internet domain .