Skip to content

Tag: currency

Number formatting (Money) in PHP

I’m trying to format numbers with not decimal points or commas, I’ve tried number_format() and money_format() and can’t seem to get the result I need. number_format($item->amount,2) Result: 14,995….

Is there any better way to get Currency Exchange Rate in PHP?

Currency Exchange Rate with below code is working sometimes and not working sometimes and not at all reliable. Is there any better way to get Currency Exchange Rate in PHP? Answer You have several issues: You’re not calling an actual API, you’re scraping a web page, which means that: you’re …

Get currency symbol in PHP

Let’s start with simple piece of code to format money with NumberFormatter: $formatter = new NumberFormatter(‘en_US’, NumberFormatter::CURRENCY); echo $formatter->formatCurrency(123456789, ‘JPY’); …

Print Currency Number Format in PHP

I have some price values to display in my page. I am writing a function which takes the float price and returns the formatted currency val with currency code too.. For example, fnPrice(1001.01) should print $ 1,000.01 Answer The easiest answer is number_format(). If you want your application to be able to wor…