![]() |
search and trim ?
I'm after a bit of help if someone can please lead me in the right direction.
I want a piece of PHP that will return me the host name of a url. So http://www.google.com/hello ..... = .... google.com http://google.com/hello..... = .... google.com www.google.com/hello..... = .... google.com you get the picture ? I have been trying to think of this logically ie 1. Search for 3rd '/' if it exists trim all to the right of it ( including '/' ) 2. trim first 7 characters off the string. 3. Count the number of '.' in the string if more than one trim upto the first one. So given http://www.google.com/hello step 1 = http://www.google.com step 2 = www.google.com step 3 = google.com I cannot think of a better way ? Have I left a loop hole ? If this follows through correctly, can someone let me know what I need to use in php to do this ? Could do it in Javascript, but not php :( Thanks for any guidance and help :) |
mmm, this seems a better way. :)
PHP Code:
|
All times are GMT. The time now is 04:52 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|