Re: differences in printf() between php and C
| From: | Gabor Hojtsy | Date: | Sat, 19 Oct 2002 10:46:07 +0000 |
| Subject: | Re: differences in printf() between php and C | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969349173@lists.php.net to get a copy of this message | ||
Please report this bug at http://bugs.php.net/ categorizing the
bug as
a documentation problem. Thanks.
Goba
----- Original Message -----
From: "Jim Mercer" <jim@reptiles.org>
To: <phpdoc@lists.php.net>
Sent: Friday, October 18, 2002 3:32 PM
Subject: [PHP-DOC] differences in printf() between php and C
>
> not sure if anyone has pointed this out, but it would be nice if it was
noted
> in the printf() manpage.
>
> in standard C, the format "%10.2f" means show 10 characters, of which the
> last 3 are decimal point and 2 digits. ie. the total length is 10 chars.
>
> in php, it appears that "%10.2f" means show 10 whole number digits,
followed
> by a decimal point and two digits.
>
> in C: printf("[10.2f]", 99.99); == [ 99.99]
> in PHP: printf("[10.2f]", 99.99); == [ 99.99]
>
> while i wouldn't expect PHP to "fix" their printf(), this difference
should
> be noted, as it definitely causes C programmers to skew their alignment.
>
> --
> [ Jim Mercer jim@reptiles.org +1 416 410-5633 ]
> [ I want to live forever, or die trying. ]
>
> --
> PHP Documentation Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>