php number_format () function syntax

php number_format () function syntax

number_format () function how to use?

php number_format () function is represented by a one thousand packets of digital format, the syntax is number_format (number, decimals, decimalpoint, separator), which function to support one, two or four parameters (not three). If the number of other parameters in addition to the parameter is not set, then the numbers will not be formatted as a decimal point and comma (,) as the thousands separator. Marble platform manufacturers

Action: to format the number by one thousand packets

语法:number_format(number,decimals,decimalpoint,separator)

parameter:

parameter description
number We must provide for the digital format
decimals Alternatively, a predetermined decimal number, if this parameter is set, the dot (.) As the decimal number to format.
decimalpoint Alternatively, a predetermined character string as a decimal point
separator Alternatively, a predetermined character string as the thousands separator, only the first character of the parameter, such as "XXX" output only "X". If you set this parameter, all other parameters are required.

Description: This function supports one, two or four parameters (not three). If the number of other parameters in addition to the parameter is not set, then the numbers will not be formatted as a decimal point and comma (,) as the thousands separator.

php number_format () function examples

 
  
? <PHP 
$ I = 4999.9; 
$ J = number_format ($ I);   
echo "output parameter without" $ J "<br /> <br />";.. 
$ I = 5000; 
$ J = number_format ( $ i, 2); // set the parameters, there are two decimal places specified 
echo "output parameters" $ J;. 
?>

  

Guess you like

Origin www.cnblogs.com/furuihua/p/11881170.html