You can format any numeric value to have decimal points by the use of PHP’s number_format() function. This is ideal when you want to deal with currency values. Below I have shown an example of how this works:
<?php $price = 10; echo $price; // outputs 10 echo number_format(number_format($price, 2, '.', '')); // outputs 10.00
On line 3 we have the $price variable with its value set to 10. On line 5 we have printed it. You will see there’s no decimal part in the output. Then on line 7, we have used the number_format() function to add 2 decimal points to the $price. So you will see its outputting 10.00.