RE: [PHP] Simple String Handling
| From: | Maxim Maletsky | Date: | Fri, 22 Dec 2000 15:08:16 +0000 |
| Subject: | RE: [PHP] Simple String Handling | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31580@lists.php.net to get a copy of this message | ||
I am telling you, explode() is better.
you can combine array_reverse() to resort the array from the back, and count
from one to two and find out EXACTLY what top level domain is and what
second level is and what is the domain itself.
How do you think the servers work themselves? I believe with an explode of C
(or whatever language they are actually using).
my 0.02 cents,
Maxim Maletsky
-----Original Message-----
From: o.cook@etoncollege.org.uk [mailto:o.cook@etoncollege.org.uk]
Sent: Saturday, December 23, 2000 12:03 AM
To: php-general@lists.php.net
Subject: RE: [PHP] Simple String Handling
Thank you to all who replied. I chose this solution as the easiest to work
with:
$tld = substr(strstr($fulldomain, '.'), 1); # Get
top-level domain
$offset = strpos($fulldomain, '.'); #
Work out where the first '.' is
$domain = substr($fulldomain, 0, $offset); # Take
everything before $offset as the domain
Regards,
Ollie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net