php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40919 Error in example code for str_pad
Submitted: 2007-03-26 11:39 UTC Modified: 2007-03-28 09:52 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: emiel at alternet dot nl Assigned:
Status: Closed Package: Website problem
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: emiel at alternet dot nl
New email:
PHP Version: OS:

 

 [2007-03-26 11:39 UTC] emiel at alternet dot nl
Description:
------------
The comments in the example code for str_pad contains an error.

On the 3rd line of the code, the function returns a 10 character string, however the comment for the code says it should return a 9 character string.

Reproduce code:
---------------
echo str_pad($input, 10);

Expected result:
----------------
// produces "Alien     "

Actual result:
--------------
// produces "Alien    "

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-26 13:12 UTC] vrana@php.net
XML source files are OK. Here is the patch for website presentation layer:

Index: layout.inc
===================================================================
RCS file: /repository/phpweb/include/layout.inc,v
retrieving revision 1.261
diff -u -r1.261 layout.inc
--- layout.inc	19 Feb 2007 23:53:02 -0000	1.261
+++ layout.inc	26 Mar 2007 13:12:03 -0000
@@ -35,6 +35,7 @@
             '<span style="color: ', // from PHP 5.0.0RC1
             '</font>',
             "\n ",
+            '  ',
             '  '
         ),
         array(
@@ -44,6 +45,7 @@
             '<span class="',
             '</span>',
             "\n&nbsp;",
+            '&nbsp; ',
             '&nbsp; '
         ),
         $highlighted

 [2007-03-28 09:52 UTC] bjori@php.net
This bug has been fixed in CVS. Since the websites are not directly
updated from the CVS server, the fix might need some time to spread
across the globe to all mirror sites, including PHP.net itself.

Thank you for the report, and for helping us make PHP.net better.

Thanks for the patch
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Nov 29 15:00:01 2025 UTC