|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-06-14 17:02 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
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 ]