davidvandertuijn/number_format_precision
最新稳定版本:1.0
Composer 安装命令:
composer require davidvandertuijn/number_format_precision
包简介
Number Format Precision
README 文档
README
The “Number Format Precision” tool is designed to provide precise control over the formatting of numerical values in PHP, specifically addressing the need for truncating decimals without rounding. This functionality is particularly useful for developers who require exact numerical representation in financial applications, scientific calculations, or any scenario where rounding could lead to inaccuracies.
PHP built-in function number_format rounds by default, this library truncates decimals without rounding.
Install
composer require davidvandertuijn/number_format_precision
Usage
Using PHP built-in function number_format:
number_format(1234.5678, 2, '.', ''); // 1234.57
Using number_format_precision:
number_format_precision(1234.5678, 2, "int")); // 1234.56 number_format_precision(1234.5678, 2, "string")); // "1234.56"
统计信息
- 总下载量: 94
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-08