- number_format: documentation ( source)
- sprintf: documentation ( source)
<?php
$total = 38.500000;
$newTotal = number_format($total,2);
echo "NumberFormat: " . $newTotal . "\n";
echo "Float: " . sprintf("%.2f", $total) . "\n";
echo "Double: " .sprintf("%.2g", $total) . "\n";