note 12123 deleted from function.sprintf by cmb
| From: | cmb@php.net | Date: | Sun, 14 Jul 2019 11:17:12 +0000 |
| Subject: | note 12123 deleted from function.sprintf by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211560@lists.php.net to get a copy of this message | ||
Note Submitter: prolixmp3 at navigators dot lv
----
If you are going to create a counter which uses _symbols_ before actual digits (see, f.e.,
SpyLog.com counters - they are filling space with "." before, so the count like 12345
looks like "........12345"), you can use the following:
$txt = "Abracadabra"; // actual string
$fit = 16; // how many digits to use
$fill = "."; // what to fill
$digits = sprintf ("%'{$fill}{$fit}s", $txt);
Paul (a.k.a. Mr.Prolix)