Quick question. What is the difference:
Total: $<?php echo number_format($totalCost, 2, ".", ","); ?>
Total: $<?php echo $totalCost;?>
Well the number format. Duh.
Basically the additional is just to guarantee the output is formated in the right way (in this case, money).
Most likely, this is because $totalcost is a calculated number (like 56000.0), and it needs to be displayed human-comfort-readable (56,000.00). Note the extra 0 and thousands seperation.