php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46912 poorly choosen/ambigous example
Submitted: 2008-12-19 23:29 UTC Modified: 2009-09-22 07:17 UTC
From: scott at thebrain dot ca Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2008-12-19 23:29 UTC] scott at thebrain dot ca
Description:
------------
Current:
$var = strspn("42 is the answer, what is the question ...", "1234567890"); will assign 2 to $var...

Index position 2 can be confused with character data '2'.

Suggestion:
$var = strspn("AB is the answer, what is the question ...", "ABCDEFGHIJ"); will assign 2 to $var...





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-19 23:33 UTC] scott at thebrain dot ca
Current:
$var = strspn("42 is the answer, what is the question ...",
"1234567890"); will assign 2 to $var...

Span length of 2 can be confused with character data '2'.

Suggestion:
$var = strspn("AB is the answer, what is the question ...",
"ABCDEFGHIJ"); will assign 2 to $var...
 [2009-09-22 07:16 UTC] svn@php.net
Automatic comment from SVN on behalf of torben
Revision: http://svn.php.net/viewvc/?view=revision&revision=288549
Log: Flush out the documentation for strspn() a bit. This an example of a
very poorly documented function.
Addresses bug #46912
This still needs work.
 [2009-09-22 07:17 UTC] torben@php.net
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.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Jun 18 12:00:01 2026 UTC