PHP float with 2 decimal places: .00

A float doesn’t have 0 or 0.00 : those are different string representations of the internal (IEEE754) binary format but the float is the same.

If you want to express your float as “0.00”, you need to format it in a string, using number_format :

$numberAsString = number_format($numberAsFloat, 2);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)