Php and displaying the right total with two decimal places?

  • Thread starter Thread starter evachick156
  • Start date Start date
E

evachick156

Guest
I have the following code:

echo "$" + number_format($totalCost, 2, '.', '');

Its supposed to display "$79.00" but instead displays 79. Please help.
 
try the following:
echo "$" . number_format($totalCost, 2, '.', '');

use dot (.) to ensure you are appending the string with a number.
 
Back
Top