quick fix | April 2nd, 2009

<?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;

?>

There are no comments yet, add one below.

Leave a Comment


You must be logged in to post a comment.