DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

PHP Dollar Format

02.17.2006
| 15652 views |
  • submit to reddit
        // Function to return amount in the format $#.##

function dollar_format($amount) {
  $new_amount = "\$".sprintf("%.2f",$amount);
  return $new_amount;
}