Jump to content

Split a variable at the dot (domain name)


simonp

Recommended Posts

As you can see there are many ways to do what you wish.

list($domain,$tld) = explode('.',$url);

if the results of explode could be varying, as if you really dont know how many dots the url would have then an array is good as you can work through it figuring out what you have. If, as you state, the url is a known and constant then it is easier to explode and assign the parts to variables all in one step.

 

 

HTH

Teamatomic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.