#42710 [Opn->Csd]: Strspn() documentation needs more explanation for start and length arguments

From: Date: Wed, 21 Nov 2007 15:59:46 +0000
Subject: #42710 [Opn->Csd]: Strspn() documentation needs more explanation for start and length arguments
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-242@lists.php.net to get a copy of this message
ID: 42710 Updated by: vrana@php.net Reported By: nikhil dot gupta at in dot ibm dot com -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Linux, Win32-xp PHP Version: Irrelevant New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Negative value counts position from the end of a string. Negative value sets length from the end of a string." Previous Comments: ------------------------------------------------------------------------ [2007-09-19 12:36:41] nikhil dot gupta at in dot ibm dot com Description: ------------ The documentation for strspn() seems to be incomplete. It donot explains the function behaviour with negative values of start and len argument.Without looking at the PHP source code one cannot confirm the behaviour of the function for negative start and len values. Reproduce code: --------------- Following can be added to the documentation: 1. When fourth argument(len) is not passed a)if $start<0 and $start >= -(length of $str) then start=start+length of $str b)if $start<0 and start < -(length of $str A) c)By default, $len=length of $str 2. When all four arguments are passed to the function: a)if $start<0 and $start >= -(length of $str) then start=start+length of $str b)if $start<0 and start < -(length of $str A) c)if $len<0 and $len >= -(length of $str - $start) then len=len+(length of $str - $start) d)if $len<0 and $len < -(length of $str - $start) then len=0. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42710&edit=1

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