Home  >  Article  >  Backend Development  >  Can I output 12345678.9 to 12,345,678.90?_PHP Tutorial

Can I output 12345678.9 to 12,345,678.90?_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 10:53:251294browse

Of course, there is a function number_format in PHP, function prototype: string thousands_sep
) )
For example:
                                                                                                            ( $num,2).'
';
    echo number_format($num,2,':').'
'; //This way of writing is wrong
    echo number_format(( $num,2,':','-').'
';
?>
The output result is:
12,345,679
12,345,678,90
Warning: Wrong parameter count for number_format() in /data/homepage/test/number_format.php on line 5
12-345-678:90





http://www.bkjia.com/PHPjc/632401.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/632401.html

TechArticleOf course, there is a function number_format in PHP, function prototype: string number_format (float number, int decimals, string dec_point , string thousands_sep ) For example: ? $num = 1234567...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn