I'm trying to create a piece of code that will take an IP address from a gethostbyname into individual Octets.
For example,
Say the gethostbyname returns the IP address of 127.0.0.1, how do I take each individual octet and put each one into it's own variable.
$octet1 = 127 $octet2 = 0 and so forth.
Is this possible?
Thanks, Xanatos
try:
ereg(\"([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\",$IP,$arg); so then test $arg[1]..$arg[4]
or $arg=split(\".\",$IP);
or list($octet1,$octet2,$octet4,$octet4)=split(\".\",$IP);