aeboi80 Posted April 19, 2010 Share Posted April 19, 2010 I need to do two things. I have a string called $domain which contains a domain name. What I need to do is know the domain name and also the domain extension. So for example lets let $domainName = mydomain.com I need to trim it to the . and store mydomain in $domain and then store com in $tld Make sense? I thought I had to explode $domainName somehow but I just can figure this out. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/ Share on other sites More sharing options...
aeboi80 Posted April 19, 2010 Author Share Posted April 19, 2010 UPDATE: Also, the domain name is not always going to be .com what if it was .us or .ws ? How can I account for the lack of knowledge of how many characters appear after the . ? Quote Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1044421 Share on other sites More sharing options...
Ken2k7 Posted April 19, 2010 Share Posted April 19, 2010 parse_url should do the job. Quote Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1044423 Share on other sites More sharing options...
salathe Posted April 19, 2010 Share Posted April 19, 2010 Do you need to cater for more than one 'extension': co.uk for example? Will there ever be any subdomains: www.example.com? Quote Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1044468 Share on other sites More sharing options...
Ken2k7 Posted April 28, 2010 Share Posted April 28, 2010 Can you have a subdomain that is www.www.domain.com? Quote Link to comment https://forums.phpfreaks.com/topic/198976-trim-string-to/#findComment-1049906 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.