bestform/divider
Composer 安装命令:
composer require bestform/divider
包简介
Service to divide a given amount into given parts
README 文档
README
The Divider class can be used to divide a certain amount into smaller parts, that can be defined.
You can use it for example to divide an amount of money into possible coins and notes. The default parts when instantiating a Divider instance are all possible € coins and notes.
Example:
<?php $divider = new Divider(); $result = $divider->divide(30); // [20 => 1, 10 => 1]
The class only handles integers, so if you are working with € keep in mind that the input as well as output is considered being cents.
Divider also handles rest values:
<?php $divider = new Divider([3]); $result = $divider->divide(4); // [3=>1, "REST" => 1]
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-01