Formatting currency values : money_format « Data Type « PHP






Formatting currency values

 
<?php
$number = 1234.56;
setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number) . "\n";

setlocale(LC_MONETARY, 'en_DK');
echo money_format('%.2i', $number) . "\n";

$number = -1234.5672;
setlocale(LC_MONETARY, 'en_US');
echo money_format('%(#10n', $number) . "\n";
echo money_format('%(#10i', $number) . "\n";
?>
  
  








Related examples in the same category

1.Formatting with money_format()