php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #800 strtok() function is don't work properly
Submitted: 1998-09-29 21:26 UTC Modified: 1998-10-03 15:36 UTC
From: hjy at wins21 dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.4 OS: windows 95/NT
Private report: No CVE-ID: None
 [1998-09-29 21:26 UTC] hjy at wins21 dot com
<?
   $string = "a          b c d e f";

   $tok = strtok($string, " ");

   while($tok) {
      printf("[%s]\n", $tok);
      $tok = strtok(" ");
   }

?>

 result is

 [a]

 if string is "a b c d e f", then result is correct, but
    string "a  b  c  d  e  f"  is not work.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-10-03 15:36 UTC] shane
Right.  strtok is not supposed to skip on tokens.  For some reason M$ decided to make strtok skip multiple tokens,
but the unix variety does not.  We'll stick with the unix way on this.  What you are looking for anyway it explode()

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 09:01:33 2024 UTC