Jump to content

Money Format


Recommended Posts

Hi everyone, im echoing a number value from my table as a number, I need to convert this to money format and ive found

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

 

how can i have this format my own variable?

<?php echo $row_getsum['SUM_value']; ?>

 

Would it be...

setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number . row_getsum['SUM_value'] . "\n";

Link to comment
https://forums.phpfreaks.com/topic/202232-money-format/
Share on other sites

I did try I just tent to waffle for some reason, Ive just tried echo money_format('%i', $row_getsum['SUM_value'];) . "\n"; only it errors and nothing is outputted, were entering values into the db such as 1234.56, could the decimal be a problem?

Link to comment
https://forums.phpfreaks.com/topic/202232-money-format/#findComment-1060460
Share on other sites

Thought id cracked it! Ive just tried

			<?php
setlocale(LC_MONETARY, 'en_GB');
$locale_info = localeconv();
print_r($locale_info);
?>

which when outputting shown my currency symbol as


[currency_symbol] => �

 

Does anybody know what causes this and how I can fix it?

Link to comment
https://forums.phpfreaks.com/topic/202232-money-format/#findComment-1060485
Share on other sites

Thought id cracked it! Ive just tried

			<?php
setlocale(LC_MONETARY, 'en_GB');
$locale_info = localeconv();
print_r($locale_info);
?>

which when outputting shown my currency symbol as


[currency_symbol] => �

 

Does anybody know what causes this and how I can fix it?

 

Set the correct character set.

Link to comment
https://forums.phpfreaks.com/topic/202232-money-format/#findComment-1060513
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.