how do i round in php with keeping the two zeros

后端 未结 3 817
感动是毒
感动是毒 2021-01-03 21:13

I have this php


and the $price maybe 1.0000

i want 1.00

3条回答
  •  清酒与你
    2021-01-03 21:52

    number_format is your best bet.

    string number_format ( float $number , int $decimals = 0 , string $dec_point = '.' , string $thousands_sep = ',' )
    

    Example:

    
    

提交回复
热议问题