PHP NumberFormatter: Locales, Currencies, Numbers to Letters

preview_player
Показать описание
I want to show/remind you of a not-so-widely used PHP class called NumberFormatter, and demonstrate to you its main capabilities.

Related links:

- - - - -
Support the channel by checking out our products:
Рекомендации по теме
Комментарии
Автор

Numbers to Letters is what I have always wanted of these. Thank you

macdanson
Автор

this is a very interesting topic, I think it will be very helpful in my projects.
thanks Povilas

ifoxash
Автор

Very interesting. Looking forward to use it. Maybe % would be useful at a sports - statistics project or sales - commission or discount calculation. Gives me some ideas.

AndyZervas
Автор

I'm using the NumberFormatter in my laravel-money package to format numbers for different locales.

devKazuto
Автор

Thanks, I was searching for someting like that!

lordbyron
Автор

useful stuff... have used it for ordinal numbers formating (1st, 2nd...)
the only downside is that you need php intl installed on your server/docker, otherwise you'll get "unknown class NumberFormatter" error... and I keep forgetting that 🙂

mc
Автор

I've never used ut, but i will start doing it from now.

TobiasOlssonHovby
Автор

It's really funny
Because today I implemented new functionality based on this class.
I display different currency format based on locale and currency

torchok
Автор

Honestly, i haven't used it... but i can see some usefull use cases

DragosBurciu
Автор

Nice to know! Regarding percentages, I'm guessing there might be locale differences in the way they are written also? And anyway you will get the correct separators.

travholt
Автор

It could be interesting to use a function like you made to show numbers and currencies based on a setting for each user. Define the locale globally based on the logged in user and then call the function without the locale.

JNL
Автор

Interesting! Do you ever implement your own NumberFormatter for other common numeric functions? Similar to the Laravel Str helper class.

natenatters
Автор

how do i spellout currency value? for example i have USD 3, 500.50, i want to echo "USD three thousand five hundred and fifty cent". can i do that using numberformatter?

mohdyuzi
Автор

Hi,
Can I use another scaffolding for laravel nova. Keep the nova auth for admin and use fortify for users for instance.
Or maybe multiple guards?

EL_PANDA_
Автор

Hi sir, this video is very helpful, recently I faced an issue with money format, now I get a perfect solution for it.
Sir can you made video about overriding vendor classes/package classes

sanoopsahadevan
Автор

Weird that € is not placed on the right, I guess it still uses the locales currency placement rule

Voltra_
Автор

This may be useful when i get to this part of my app. beats researching the formats myself.

Are you aware of any packages or methods that would help with phone number or address formats for various countries?

jcc
Автор

I am using it in a helper function for blade outputs. Is there also a way for using it with numbers based on 2? (1024B = 1kB) Therfore I pasted a Stackoverflow solution.

fahnleindieselschweif
Автор

Hi Sir, after watch this video, I find out to the documentation of named parameter. Then I found that order of the variables are passed does not matter, different with your explain in the video. I tried it and the order does not matter like the doc said. Is there specific condition why order is still important or no? Thanks for the great explanation Sir.

Rivera-D
Автор

Very helpful video. Is NumberFormatter available only in php 8?

strilezkijslawa