string strstr ( string str, string needle )
string stristr ( string str, string needle )
$url = "www.xxx.com";
$domain = strstr ($url, ".");
In this example in which you are attempting to find the domain name of the current string, the strstr() function finds the first instance of the dot (.) character and then outputs everything starting with the first instance of the dot. In this case, the output would be `.xxx.com`.