PHP float with 2 decimal places: .00

后端 未结 11 1042
野性不改
野性不改 2020-12-08 06:34

When I do this typecasting:

(float) \'0.00\';

I get 0. How do I get 0.00 and still have the data type as a float?

11条回答
  •  爱一瞬间的悲伤
    2020-12-08 07:07

    Use the number_format() function to change how a number is displayed. It will return a string, the type of the original variable is unaffected.

提交回复
热议问题