Use a grep tool, most ide's will grep.
Nov 25, 2022
5
Level 3
number format with dots and commas switched
I've been using number_format($num, 2) on a project that I've been developing for quite a while now.
But I just realized that my country (Turkey) uses them other way around 😅
Turns out we use 123.456,00 instead of 123,456.00
I noticed that I can fix this by doing number_format($num, 2, ',', '.') but I've used it on many (m a n y) different places now. Is there a way that I can fix this for all of the formatted numbers I've written before?
I tried 'locale'=> 'tr' in config/app.php file since number_format allegedly formats it in the set country's currency format, but it didn't do anything.
Level 102
Just make your own helper function that that does it for you
function number_format_turkey($num)
{
return number_format($num, 2, ',', '.');
}
Now replace all usages with your own function
1 like
Please or to participate in this conversation.