public static function is_root($domain) { $tlds = Whois::get_tlds(); $domainArr = explode('.', $domain); $count = count($domainArr); if ($count < 2 || $count > 3) { return false; } elseif ($count == 2) { return true; } else { // 2-th zone domain if (strlen($domainArr[1]) > 4) { return false; } elseif (!in_array($domainArr[1] . '.' . $domainArr[2], $tlds) && !in_array($domainArr[1], array('us', 'com', 'ru', 'info', 'biz', 'org', 'net'))) { echo $domainArr[1] . '.' . $domainArr[2] . "<br />"; return false; } else { return true; } } }