I want to format a float value I have to two decimal places.
For example if I have a float for a price of 5.2, I want it to be formatted as 5.20>
5.2
5.20>
If you're simply trying to ensure a number is displayed with two decimal places, you could also use number_format, or (if this is a currency value) money_format.
e.g.: echo number_format('5.2', 2);
echo number_format('5.2', 2);