note 44646 deleted from function.sprintf by cmb
| From: | cmb@php.net | Date: | Sun, 14 Jul 2019 11:16:46 +0000 |
| Subject: | note 44646 deleted from function.sprintf by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211559@lists.php.net to get a copy of this message | ||
Note Submitter: Gkeeper80
----
When using sprintf with padding, it's important to note that specifying the length of your
padding does not restrict the length of your output.
For example:
$var = 'test';
$output sprintf("%03s", $var);
print $output;
Produces:
test
NOT:
est
This may seem intuitive for working with numbers, but not neccesarily when working with strings.