- www.example.com
- foo.example.com
- foo.example.co.uk
- foo.bar.example.com
- foo.bar.example.co.uk
I've got these URL's here, and want to always end up with 2 variables:
$domainName = "example"
$domainNameSuffix = ".com" OR ".co.uk"
If I someone could get me from $url being one of the urls, all the way down to $newUrl being close to "example.co.uk", it would be a blessing.
Note that the urls are going to be completely "random", we might end up having "foo.bar.example2.com.au" too, so ... you know... ugh. (asking for the impossible?)
Cheers,