0

I would like to get the currency symbol for an ISO-3 string in Laravel 8.x.

Example:

$iso_code = 'EUR';
$symbol = convertToSymbolFunction('EUR');

echo $symbol;

...and the $symbol would equal to:

'€'

I know that there is a native PHP NumberFormatter function, but that requires the locale of the user. I'm wondering if there's a simpler version or a library for Laravel that supports something like the above example.

lagbox
  • 48,571
  • 8
  • 72
  • 83
Radical_Activity
  • 2,618
  • 10
  • 38
  • 70
  • 2
    Does this answer your question? [Get currency symbol in PHP](https://stackoverflow.com/questions/13897516/get-currency-symbol-in-php) – Jeto Oct 13 '20 at 17:38
  • @Jeto Nope, I've read that, and I don't want to use PHP's Number formatter as written in my original post. – Radical_Activity Oct 13 '20 at 17:42
  • 3
    I know you've mentioned it. But the picked answer explains exactly why you don't really have a choice: there is no universal/"official" symbol for any given currency. – Jeto Oct 13 '20 at 17:44
  • 2
    There is already an answer while using Symfony in the same thread, https://stackoverflow.com/a/16942190/9992791 Your question is really vague, and Jeto already answered with a real solution. – RG Servers Oct 13 '20 at 18:10

0 Answers0