note 22641 rejected from function.strtok by irchtml
| From: | irchtml@php.net | Date: | Thu, 05 Feb 2004 06:23:03 +0000 |
| Subject: | note 22641 rejected from function.strtok by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64662@lists.php.net to get a copy of this message | ||
Note Submitter: dxue69@hotmail.com
----
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