- Number_format (288);
- Output 288
- Number_format (365,2);
- Output 365.00
- Number_format (365000000,3, ".") (The number 365000000 is reserved for 3 decimal places, and the decimal point is ".") Said
- Output: 365,000,000.000
- Number_format (365000000,2, ".", "*") (the number 365000000 is reserved for 2 decimal places, the decimal point is ".") Indicates that the thousand separator is denoted by "*")
- Output: 365*000*000.00
Copy CodeAttached, an example of the number of decimal places that PHP intercepts:
Number_format method
- $number _format $number = 1234.5678;
- $nombre _format_francais = Number_format ($number, 2, ', ', '); 1 234,57
- $english _format_number = Number_format ($number, 2, '. ', '); 1234.57
- Round method bbs.it-home.org
- Round $number = 1234.5678; Echo Round ($number, 2); 1234.57
- sprintf method
- sprintf $formatted = sprintf ("%s has ¥%01.2f. ", $name, $money); Echo $formatted; Zhang San has ¥123.10.
- ?>
Copy Code |