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

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

1 comment

  1. anonymous

    thanks my friend

Leave a Reply