Doc #78165 [Ver->Csd]: Incorrect example with printf
| From: | cmb@php.net | Date: | Fri, 14 Jun 2019 17:57:07 +0000 |
| Subject: | Doc #78165 [Ver->Csd]: Incorrect example with printf | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16754@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78165&edit=1
ID: 78165
Updated by: cmb@php.net
Reported by: cfesting at yahoo dot com
Summary: Incorrect example with printf
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: Strings related
PHP Version: Irrelevant
Assigned To: cmb
Block user comment: N
Private report: N
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.
Previous Comments:
------------------------------------------------------------------------
[2019-06-14 17:56:18] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=347601
Log: Fix #78165: Incorrect example with printf
We also remove the useless self-reference from the "see also" section.
------------------------------------------------------------------------
[2019-06-14 17:13:05] requinix@php.net
It's kinda left-justified, kinda not, depending how you look at it.
So how about we ignore the problem entirely and change the example instead?
printf("[%20.10s]\n", $t); // right-justification but with a cutoff of 10 characters
printf("[%-20.10s]\n", $t); // left-justification but with a cutoff of 10 characters
with output
[ many monke]
[many monke ]
------------------------------------------------------------------------
[2019-06-14 17:09:57] girgias@php.net
The output is [many monke] which seems left-justified to me.
See https://3v4l.org/68s7r
------------------------------------------------------------------------
[2019-06-14 17:02:32] cfesting at yahoo dot com
Description:
------------
---
From manual page: https://php.net/function.printf
---
In example #2:
printf("[%10.10s]\n", $t); // left-justification but with a cutoff of 10 characters
It is my belief that the above will be right-justified, not left.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78165&edit=1