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