quick fix | April 2nd, 2009

Formatting money / currency using PHP

// Our original decimal number

$number = 21357.44;

// Let’s use PHP’s built-in function to format the number into US currency

$formatted = number_format($number, 2);

// The following statement will print 21,357.44

echo “\$” . $formatted;

?>

4 comments

  1. cheap viagra online

    Jul 31st, 2020

    Amazing article, lots of intersting things to digest. Very informative

  2. Piercing

    Aug 2nd, 2020

    Andy, a very interesting post thanks for writing it!

  3. babafisa

    Aug 3rd, 2020

    i loved the article added to my favourites

  4. ultrasurf

    Aug 3rd, 2020

    Very enjoyed this! Well done!

Trackbacks and Pingbacks

    Leave a Comment