{"id":16950338,"url":"https://github.com/wilon/php-number2chinese","last_synced_at":"2025-04-05T20:08:08.482Z","repository":{"id":57080941,"uuid":"84385531","full_name":"wilon/php-number2chinese","owner":"wilon","description":"PHP 数字转为中文汉字描述、人民币大写方法。","archived":false,"fork":false,"pushed_at":"2023-09-04T09:54:49.000Z","size":24,"stargazers_count":142,"open_issues_count":1,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T19:06:02.184Z","etag":null,"topics":["php","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wilon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-09T01:51:22.000Z","updated_at":"2024-11-05T12:32:57.000Z","dependencies_parsed_at":"2024-06-19T17:41:47.644Z","dependency_job_id":"33ff4bac-2ee9-481e-a847-54f9324503a9","html_url":"https://github.com/wilon/php-number2chinese","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":0.08695652173913049,"last_synced_commit":"e6f5a804b01c3f068cb3d873387d300cbeaed6f8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilon%2Fphp-number2chinese","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilon%2Fphp-number2chinese/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilon%2Fphp-number2chinese/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wilon%2Fphp-number2chinese/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wilon","download_url":"https://codeload.github.com/wilon/php-number2chinese/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393570,"owners_count":20931813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php-library"],"created_at":"2024-10-13T21:57:24.302Z","updated_at":"2025-04-05T20:08:08.459Z","avatar_url":"https://github.com/wilon.png","language":"PHP","readme":"# PHP number2chinese\n\n点击校验👉👉👉[![Build Status](https://travis-ci.org/wilon/php-number2chinese.svg?branch=master)](https://travis-ci.org/wilon/php-number2chinese)\n\n[![Packagist][badge_package]][link-packagist]\n[![Packagist Release][badge_release]][link-packagist]\n[![Packagist Downloads][badge_downloads]][link-packagist]\n\n[badge_package]:      https://img.shields.io/badge/package-wilon/php--number2chinese-blue.svg?style=flat-square\n[badge_release]:      https://img.shields.io/packagist/v/wilon/php-number2chinese.svg?style=flat-square\n[badge_downloads]:    https://img.shields.io/packagist/dt/wilon/php-number2chinese.svg?style=flat-square\n[link-packagist]:     https://packagist.org/packages/wilon/php-number2chinese\n\nPHP 数字转为汉字描述，人民币大写方法。\n\n * 个，十，百，千，万，十万，百万，千万，亿，十亿，百亿，千亿，万亿，十万亿，百万亿，千万亿，兆；此函数亿乘以亿为兆\n \n * 以「十」开头，如十五，十万，十亿等。两位数以上，在数字中部出现，则用「一十几」，如一百一十，一千零一十，一万零一十等\n\n * 「二」和「两」的问题。两亿，两万，两千，两百，都可以，但是20只能是二十，200用二百也更好。22,2222,2222是「二十二亿两千二百二十二万两千二百二十二」\n \n * 关于「零」和「〇」的问题，数字中一律用「零」，只有页码、年代等编号中数的空位才能用「〇」。数位中间无论多少个0，都读成一个「零」。2014是「两千零一十四」，200014是「二十万零一十四」，201400是「二十万零一千四百」\n \n * 参考：https://jingyan.baidu.com/article/636f38bb3cfc88d6b946104b.html\n\n * 人民币写法参考：[正确填写票据和结算凭证的基本规定](http://bbs.chinaacc.com/forum-2-35/topic-1181907.html)\n\n### 安装\n\n\u003e *php -v \u003e= 5.4*\n\n在 `composer.json` 文件中添加\n\n```json\n\"wilon/php-number2chinese\": \"~1.0\"\n```\n\n或者\n\n```sh\ncomposer require wilon/php-number2chinese\n```\n\n### 使用方法\n\n\u003e #string number2chinese ( mixed $number [, bollen $isRmb] )#\n\n*将$number转为汉字念法*\n\n* mixed $number\n\n    输入数字或字符串。\n    当数字过大或过小时，请输入string\n    支持负数\n\n* bollen $isRmb\n\n    默认为false，当为true时返回人民币大写汉字\n    人民币最大单位[仟兆]，最小单位[毫]\n\n### 代码示例\n\n```php\n$num1 = 0.1234567890;\necho number2chinese($num1);    // 零点一二三四五六七八九\necho number2chinese($num1, true);    // 零元壹角贰分叁厘肆毫\n$num2 = 20000000000000000;\necho number2chinese($num2);    // 两兆\necho number2chinese($num2, true);    // 贰兆元整\n$num3 = -1202030;\necho number2chinese($num3);    // 负一百二十万零两千零三十\necho number2chinese($num3, true);    // 负壹佰贰拾万零贰仟零叁拾元整\n```\n\n当数字过大时，请输入string\n```php\n$num2 = 1234567890.0123456789;\necho number2chinese($num2);    // 十二亿三千四百五十六万七千八百九十点零一二三\necho number2chinese($num2, true);    // 壹拾贰亿叁仟肆佰伍拾陆万柒仟捌佰玖拾元零壹分贰厘叁毫\n$num2 = '1234567890.0123456789';\necho number2chinese($num2);    // 十二亿三千四百五十六万七千八百九十点零一二三四五六七八九\necho number2chinese($num2, true);    // 壹拾贰亿叁仟肆佰伍拾陆万柒仟捌佰玖拾元壹分贰厘叁毫\n```\n\n 若想精确小数点后两位，请先处理$num1\n```php\n$num1 = 0.1234567890;\necho number2chinese(number_format($num1, 2));    // 零点一二\necho number2chinese(number_format($num1, 2), true);    // 零元壹角贰分\n```\n\n### 测试\n\n```\nphp vendor/wilon/php-number2chinese/test.php    // 随机一些数据进行测试\nphp vendor/wilon/php-number2chinese/test.php 2000   // 指定数字\n```\n\n______\n有问题？\u003ca href=\"https://github.com/wilon/php-number2chinese/issues\" target=\"_blank\"\u003e发issues\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilon%2Fphp-number2chinese","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilon%2Fphp-number2chinese","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilon%2Fphp-number2chinese/lists"}