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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hjy at wins21 dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 14:01:34 2025 UTC