Re: PHP 4.0 Bug #8803 Updated: crazy implementation of printf/sprintf
| From: | Sascha Schumann | Date: | Fri, 19 Jan 2001 15:24:16 +0000 |
| Subject: | Re: PHP 4.0 Bug #8803 Updated: crazy implementation of printf/sprintf | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-44565@lists.php.net to get a copy of this message | ||
On 19 Jan 2001 derick@php.net wrote:
> ID: 8803
> Updated by: derick
> Reported By: mikeb@gbdirect.co.uk
> Old-Status: Open
> Status: Closed
> Bug Type: Unknown/Other Function
> Assigned To:
> Comments:
>
> This works fine:
>
> echo sprintf ("%2x", 29);
>
> output:
> 1d
>
> This is not a bug.
Does %.2x work? If not, then it is indeed not in compliance
with C99. 7.19.6 says:
An optional precision that gives the minimum number of
digits to appear for the [..] x, and X conversions [..].
o,u,x,X: [..]
The precision specifies the minimum number of
digits to appear; if the value being converted
can be represented in fewer digits, it is
expanded with leading zeros. The default
precision is 1.
- Sascha