PHP number_format
() . . , .
number_format()
PHP - , . :
string number_format(float $number)
$number
.
, , . . .
<?php
$number1 = 12345678.4321;
$result1 = number_format($number1);
$number2 = 12345678.5678;
$result2 = number_format($number2);
?>
.
, PHP number_format
() .
string number_format(float $number, int $decimals)
$decimals
- (integer), , . , .
, , .
<?php
$number1 = 12345678.4321;
$result1 = number_format($number1, 2);
$number2 = 12345678.5678;
$result2 = number_format($number2, 1);
$number3 = 12345678;
$result3 = number_format($number3, 3);
?>
. .
, PHP number_format
() . , - .
string number_format(float $number, int $decimals, string $dec_point, string $thousands_sep)
$dec_point
, $thousands_sep
. , . , .
php number_format :
<?php
$number1 = 12345678.4321;
$number2 = 12345678.5678;
$number3 = 12345678;
$result1 = number_format($number1, 5, '.', ',');
$result2 = number_format($number2, 5, '^', ' ');
$result3 = number_format($number2, 5, '-', '');
$result4 = number_format($number3, 5, '***', 'xxx');
?>
, .
PHP number_format
() . , .