How to format a dollar amount using PHP; money format; number_format

Content

This will format a number into a dollar amount.

function money_format($amount) {     return number_format($amount, 2, '.', ','); }

Example:

$amount = 123456; echo money_format($amount); // 123,456.00
Posted . Did this help you? Please let me know with a comment. Thank you

Comments (RSS)

  1. anonymous

    thanks my friend