sanmai / japanese-numerals
Library to convert Japanese numeral to their Western variants (AKA Hindu-Arabic numerals)
v0.1.5
2026-11-18 00:25 UTC
Requires
- php: >=7.4
- ext-bcmath: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2
- php-coveralls/php-coveralls: ^2
- phpunit/phpunit: <10
- sanmai/phpunit-legacy-adapter: ^6.4 || ^8.2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
JapaneseNumeral
Library to convert Japanese numeral to their Western variants (AKA Hindu-Arabic numerals)
Installation is simple:
composer require sanmai/japanese-numerals
Usage
To convert a number from Hindu-Arabic numerals to Japanese numerals, use:
$japanese = \JapaneseNumerals\JapaneseNumerals::fromArabicToJapanese(123); var_dump($japanese);
Should output:
string(12) "百二十三"
To convert a string of Japanese numerals to Hindu-Arabic numerals, use:
$arabic = \JapaneseNumerals\JapaneseNumerals::fromJapaneseToArabic('二千二十五'); var_dump($arabic);
Should output:
string(4) "2025"
Acknowledgements
Special thanks go to Navarr Barnier (@navarr) for the initial implementation of the algorithm.