Re: Number Format
| From: | Andy Styles | Date: | Sat, 03 Jun 2000 13:26:47 +0000 |
| Subject: | Re: Number Format | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-951@lists.php.net to get a copy of this message | ||
On Sat, 3 Jun 2000 06:40:21 +0530, D u r r a n i wrote:
>I am having trouble in formating the following number: 0.306641
>Instead of printing this I want to print 0.31 using printf statement of PHP.
>
>printf("</td><td align=right> %f KB </td><td>",
>$filesize/1024);
If no-one has replied yet,
printf("</td><td align=right> %.2f KB </td><td>",
$filesize/1024);
%.2f specifies 2 places after the decimal..
Andy.