Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/74117-explode-the-site-name/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374306
Share on other sites

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.."

 

Link to comment
https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374320
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/74117-explode-the-site-name/#findComment-374447
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.