|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8034 string function (strcspn)
Submitted: 2000-11-29 11:03 UTC Modified: 2000-12-07 05:49 UTC
From: rottmann at inveris dot de Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.3pl1 OS: linux (suse)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
29 + 26 = ?
Subscribe to this entry?

 [2000-11-29 11:03 UTC] rottmann at inveris dot de
why is "string function" not in the Type of bug: list??

$stringvalue = "xy.,.-,z1";

echo strspn (strtolower ($stringvalue), "abcdefghijklmnopqrstuvwxyz0123456789") . "<br>"; // right
echo strcspn (strtolower ($stringvalue), "abcdefghijklmnopqrstuvwxyz0123456789") . "<br>"; // wrong

the strspn returns the right value...
but strcpsn returns only the right value when the first digit is not in the 2nd string?!?!? or i did misunderstand the


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-07 05:49 UTC]
For me strcspn returns 0, which is the correct result, since
strcspn is meant to return length of the segment that does
not contain any of the characters in the second arg. Since
"x" (the first character) is already there, the length is 0.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 17 04:05:45 2022 UTC