Re: display provider name form hostname



"Eric Rechter" <erikrechter@xxxxxxxxx> wrote:
I only want to display the provider name from a hostname, so I need to
divide the string to take only de characters from after the before last dot.

For example:

dsl-083-247-088-130.solcon.nl -> I only wanna display "solcon.nl"

$hostname = "dsl-083-247-088-130.solcon.nl";
$parts = explode('.', $hostname);
if (count($parts) >= 2)
$provider_name =
$parts[count($parts) - 2] . '.' . $parts[count($parts) - 1];
else
$provider_name = $hostname;

miguel
--
Photos from 40 countries on 5 continents: http://travel.u.nu
Latest photos: Malaysia; Thailand; Singapore; Spain; Morocco
Airports of the world: http://airport.u.nu
.



Relevant Pages

  • Re: undefined index
    ... Jerry has hit it. ... You will never get an index with a dot in it from ... Airports of the world: http://airport.u.nu ...
    (comp.lang.php)
  • Re: Using periods/dots within file names
    ... My partner and I have used and successfully tested what I created and refer to as the Dot Notation File Naming Schema. ... Have fun with your "descriptive" naming noting the only legitimate and required limits are those imposed by the file system which limits the total number of alphanumeric characters in the string used to name a file noting the. ... As I recall even the 8.3 file naming convention allowed us to delineate file names using any number of dots noting we only had 8 characters to work with for the name so doing so was not as practical as we can now take advantage of on the Windows file system which support 256 characters in a file name. ...
    (microsoft.public.dotnet.general)
  • Re: The downsides of pseudo-historical fiction
    ... characters in a variety of roles, ... While blackness is clearly more politically correct than ... whether whales are more politically correct than native ... email to oshea dot j dot j at gmail dot com. ...
    (rec.arts.sf.composition)
  • Re: Language Selcection Philosophy
    ... sure the Germans can handle using a dot instead of a comma and are probably forced to by many other systems or 2) This can be selected at run-time and I can modify my DrawDecimalfunction to reference a variable before is draws a comma or a dot. ... Remember different languages require different characters - even Latin alphabet texts often have accented characters. ... You can get around a lot of it if you use printf variants for your display, and let the format strings also be language-dependant. ...
    (comp.arch.embedded)
  • Re: Whats wrong with RegularExpressionValidator?
    ... delineated with a dot character. ... an example containing all allowable characters follows the ** ... in which case the following may suit your purposes (it ...
    (microsoft.public.dotnet.framework.aspnet)

Loading