Doc #52509 [Opn->Asn]: strcspn() docs are not clear

From: Date: Tue, 10 Aug 2010 17:29:23 +0000
Subject: Doc #52509 [Opn->Asn]: strcspn() docs are not clear
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4834@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52509&edit=1 ID: 52509 Updated by: philip@php.net Reported by: mr dot joebert at gmail dot com -Summary: Confusing description +Summary: strcspn() docs are not clear -Status: Open +Status: Assigned Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: philip Block user comment: N Previous Comments: ------------------------------------------------------------------------ [2010-08-01 21:14:39] mr dot joebert at gmail dot com 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52509&edit=1

« previous php.doc.bugs (#4834) next »