PHP/Development/Number Format — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 10:03, 26 мая 2010
Number format for current
<source lang="html4strict">
<?php
$shoe_price = 86749.9500001; print($shoe_price . "\n"); print("\$" . number_format($shoe_price, "2", ".", "") . "\n");
?>
</source>
Number format function prototype
<source lang="html4strict">
<? string number_format(float number, int decimals, string dec_point, string
thousands_sep)
?> Argument Description number Number to be formatted decimals Precision: number of decimal places dec_point String used for the decimal point (in North America, usually a period) thousands_sep String to separate groups of thousands (in North America, usually a comma)
</source>
Number with dot
<source lang="html4strict">
<? echo number_format("12156688","2",".",","); ?>
</source>