problem with join(array, "")
| From: | Dave Hull | Date: | Wed, 31 May 2000 13:53:34 +0000 |
| Subject: | problem with join(array, "") | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-711@lists.php.net to get a copy of this message | ||
I've got the following code which splits an ip address into it's four
octets:
$octet[4] = strtok($remote_ip, ".");
for ($i = 3; $i >= 1; $i--) {
$octet[$i] = strtok(".");
}
If I add code as follows:
for ($i = 1; $i <= 4; $i++) {
echo $octet[$1];
}
it prints the octects in reverse so 192.168.47.8 becomes 847168192. However,
if I add the following lines:
$revip = join($octet, "");
echo $revip;
this should join the octet[] array into a string with "" as the separator.
However, when the output of the next line is not 847168192, it's 192168478.
Anyone know if this is a bug or a feature? Am I misunderstanding something
here?
Thanks.
dp