Re: problem with join(array, "")

From: Date: Wed, 31 May 2000 13:57:06 +0000
Subject: Re: problem with join(array, "")
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-712@lists.php.net to get a copy of this message
By the way, I realized after posting that it's supposed to be joing("", array). I have tried it that way and the result is the same. Any thoughts? dp "Dave Hull" <dphull@NO_SPAM.ukans.edu> wrote in message news:8h3581$1i4$1@cvs.php.net... > 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 > > > > -- > 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 >

« previous php.general (#712) next »