How do I make a data entry of 5500 auto display as 5,500.00

3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 29, 2011   (RSS)

Re: [equinox69] How do I make a data entry of 5500 auto display as 5,500.00

By Damon - March 29, 2011

Hi,

Try the number_format function:
<?php
$number = 2300;
$formatted = number_format($number);
?>

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] How do I make a data entry of 5500 auto display as 5,500.00

By Codee - March 29, 2011 - edited: March 30, 2011

Thanks Damon! That coupled with the following code snippet works like a charm!

<?php if ($record['price']): ?>
<?php
$number = $record['price'];
setlocale(LC_MONETARY, 'en_US');
echo money_format('%(#10.2n', $number) . "\n";
?>
<br clear="all">
<?php endif ?>