strtok bug
| From: | Florin Sanda | Date: | Wed, 04 Oct 2000 01:37:25 +0000 |
| Subject: | strtok bug | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18579@lists.php.net to get a copy of this message | ||
Hi,
strtok() function has a little bug (it's not working like in Java anyway)
here is an example to see what I mean:
<?
$string="hello,world";
$tok=strtok($string," ,");
while($tok)
{
echo "$tok@";
$tok=strtok(" ,");
}
?>
the output is "hello@world@" which is fine,
but when $string="hello, world" (multiple seperators one after each other)
the output is just "hello@" !!!
Is this a PHP version problem?
Florin Sanda
PRO Web Solutions
http://www.proweb.ro