Re: strtok buggy ?

From: Date: Wed, 28 Jun 2000 12:30:45 +0000
Subject: Re: strtok buggy ?
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-22616@lists.php.net to get a copy of this message
Just read the sample in the php doc !!!!!! String functions -> Strtok Stanislav Malyshev wrote: > CS>> It seem that strtok trouble with the 0 string. Try this little > CS>> script : > CS>> > CS>> $str = "ta-mere-en-0-short"; > CS>> $tok = strtok ($str,"-"); > CS>> while ($tok) > > No, there's trouble with your while. "0" has false value when converted to > boolean. Use != "" or something like that. > > -- > Stanislav Malyshev stas@zend.com > +972-3-6139665 > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.dev (#22616) next »