How to convert number to float in PHP

one text

Solution:

You can use number_format function to format the numbers for desired output.

$foo = "105.01";
$zoo = "105";
echo number_format((float)$foo, 2, '.', ''); //Output 105.01
echo number_format((float)$zoo, 2, '.', ''); //Output 105.00

Source