php float 2 decimais 1

php float 2 decimais

$num = 5;
$num = number_format($num, 2);

Here is what the above code is Doing:
1. We’re creating a variable called $num and assigning it the value of 5.
2. We’re then using the number_format() function to format the number.
3. The first parameter is the number we want to format.
4. The second parameter is the number of decimal places we want to display.

Similar Posts