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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 08:01:34 2025 UTC