php - float value with two decimal places

Viewed 1465

Is there any way in PHP to have a float value (not a string) with two decimal places if these are zeroes?

Example:

$v = 1.50

Using (float) or floatval($v) would return the number as 1.5

I get that I can use number_format() for an arbitrary precision, but that would return a string, and once I cast it to a float, I hit the same problem.

3 Answers
Related