|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-08-10 19:29 UTC] philip@php.net
-Summary: Confusing description
+Summary: strcspn() docs are not clear
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: philip
[2010-08-10 19:37 UTC] philip@php.net
[2010-08-10 19:38 UTC] philip@php.net
-Status: Assigned
+Status: Closed
[2010-08-10 19:38 UTC] philip@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 10 07:00:01 2026 UTC |
Description: ------------ The description for the strcspn function is confusing. "Returns the length of the initial segment of str1 which does not contain any of the characters in str2." This seems to indicate that the function looks for a string of unexpected characters and returns the length of that string. When what really happens, is that the function will either return zero, or, if the string starts with unexpected characters, return the length of that. Behavior I would expect from the description, strcspn('abcd', 'abc') == 1 strcspn('dabc', 'abc') == 1 What really happens strcspn('abcd', 'abc') == 0 strcspn('dabc', 'abc') == 1