note 22641 added to function.strtok
| From: | dxue69 at hotmail dot com | Date: | Tue, 25 Jun 2002 20:25:58 +0000 |
| Subject: | note 22641 added to function.strtok | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32195@lists.php.net to get a copy of this message | ||
If you tokenize a string containing "0" such as "0,1,2"
strtok will fail when tokenizing the 0 in the beggining.
$tok=strtok($begin_with_0, ",")
while($tok){
echo("$tok ");
}
will not print anything. To get around this you need to use split()
$tok_array=split(",", $begin_with_0);
then 0,1,2 will be in $tok_array
--
http://www.php.net/manual/en/function.strtok.php
http://master.php.net/manage/user-notes.php?action=edit+22641
http://master.php.net/manage/user-notes.php?action=delete+22641
http://master.php.net/manage/user-notes.php?action=reject+22641