Skip to content

Conversation

@BogdanUngureanu
Copy link
Contributor

This PR introduces two new constants, DECIMAL_COMPACT_SHORT and DECIMAL_COMPACT_LONG, in the NumberFormatter class. These constants are mapped to ICU’s UNUM_DECIMAL_COMPACT_SHORT and UNUM_DECIMAL_COMPACT_LONG.

Although ICU has supported these since version 57, they were not previously exposed in PHP's NumberFormatter class. This update addresses that by adding them.

@devnexen
Copy link
Member

devnexen commented Mar 5, 2025

Nice ! looks good in first glance I ll go back at it shortly.

@BogdanUngureanu
Copy link
Contributor Author

Awesome, thanks for the fast response! For the record, this has been working since PHP 5.5 with regular int values (https://3v4l.org/suSMd), but we don't expose it in the docs and this class.

I came across it on stackoverflow where someone was using NumberFormatter::PADDING_POSITION attribute, which coincidentally has the same int value as the formatter.

@devnexen devnexen closed this in 97402d5 Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants