- number_format: documentation ( source)
- sprintf: documentation ( source)
- printf: documentation ( source)
<?php
$rate1 = 0.02;
$var = sprintf("%.2f",1260);
echo $var,"\n\n";
// two ways to format the product
echo number_format( $rate1 * $var, 2),"\n";
echo printf("%.2f",$rate1 * $var);