This PHP string snippet will divide a string, this instance uses the : (colon) as the dividing characted but you can use whatever you want, even a space. The strpos() function finds the numerical position of the colon in the string and then the substr_replace() function removes everything after and including the colon. Use this snippet to obtain a subdomain from a url, first add a str_replace() to remove the http:// then run this script with a period instead of a colon.
