Using Substring Alternatives
//string strstr ( string haystack, string needle ) //string stristr ( string haystack, string needle ) <?php $url = "www.java2s.com"; $domain = strstr ($url, "."); echo $domain; ?>