Over a million developers have joined DZone.

PHP Dollar Format

·
// Function to return amount in the format $#.##


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

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}