mrjameer Posted October 20, 2007 Share Posted October 20, 2007 hi, i have a web site name called www.welcome.com i want to break or explode the site name and store in 3 different variables as follows . $variable1=www; $variable2=welcome; $variable3=com; how i can achieve this.any of your help will be surely appreciated. thanks mrjameer Quote Link to comment https://forums.phpfreaks.com/topic/74117-explode-the-site-name/ Share on other sites More sharing options...
MadTechie Posted October 20, 2007 Share Posted October 20, 2007 it maybe in the manual! let me check.. oh yes it is.. http://uk2.php.net/manual/en/function.explode.php and even better it has examples.... Quote Link to comment https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374255 Share on other sites More sharing options...
Wuhtzu Posted October 20, 2007 Share Posted October 20, 2007 First of MadTechie is right... explode is what you are looking for and the link he gave is excellent. Second, sorry for going off topic: MadTechie: Can we (you, me and anyone else who refers to things as "being in the manual") expect people who are new to PHP to be able to find for example explode() in the manual when they need to split a string? To link the splitting of a string to explode()? My personal opinion on this is that if you can't link for example splitting a string to explode() you should read some basic PHP tutorials or books. Quote Link to comment https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374306 Share on other sites More sharing options...
MadTechie Posted October 20, 2007 Share Posted October 20, 2007 I think the question, was kinda pointless.. he refers to site name being www.welcome.com and to break or explode.. so to look at the post again he might of well said i want to explode www.welcome.com and store in 3 different variables as follows . $variable1=www; $variable2=welcome; $variable3=com; also if you look in the manual, section "strings" and read the list your find "explode — Split a string by string", i don't mind helping but i have spent just under 2 days trying to resolve a problem and was very close to posting.. sometimes i know is something stupid i have done.. and a second pair of eyes help.. but this post just seams too lazy.. hence the "oh yes it is.." Quote Link to comment https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374320 Share on other sites More sharing options...
Wuhtzu Posted October 20, 2007 Share Posted October 20, 2007 Just wanted to ask Quote Link to comment https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374350 Share on other sites More sharing options...
igor berger Posted October 21, 2007 Share Posted October 21, 2007 also take a look how parse_url() works. But their are adherint problems with .co.jp com.cn etc. these are called TLD's if you want this to work perfectly for all combination fo domains extensions you will need to get a TLD dump and the script for doing this... It gets a bit complecated so just possibility of what possible. Quote Link to comment https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374447 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.