Question

I'm at the moment using the PHP money_format() function, and have money_format('%.0i', $row['price']) at the moment it outputs something like: DKK 199.900 - is there a way I can output it like 199.900 DKK instead?

Was it helpful?

Solution

Use number_format instead (this is cross OS compatible too):

$value = number_format($value, [decimal places]).' DKK';

OTHER TIPS

replace first argument of money_format to '%.0i DKK';

So the pattern money_format('%!.0i DKK', $price); could be a solution where ! will put off auto currency sign and it is added manually at the end

Actually @sandeep was right, he just forgot to add the ! to remove the monetary symbol from the beginning.

setlocale(LC_MONETARY, 'da_DK');
$money_in_the_bank = 9333;
echo money_format('%!.0i DKK', $money_in_the_bank);

This will output:

9.333 DKK

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top