Ad

Is There Any Way To Format Or Convert Number In Laravel Blade

- 1 answer

When I use the PHP function format_number to convert my variable value which is like 123456789, it converts it with thousand separators like this: 123,456,789. What I want is to format it like this: 12,34,56,789

Is there any way to achieve this?

Ad

Answer

Based on this answer:

$amount = 123456789;
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%!.0i', $amount);

You can then pass the $amount variable to your blade template.

Ad
source: stackoverflow.com
Ad