davidvandertuijn/number_format_precision 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

davidvandertuijn/number_format_precision

最新稳定版本:1.0

Composer 安装命令:

composer require davidvandertuijn/number_format_precision

包简介

Number Format Precision

README 文档

README

Total Downloads Latest Stable Version License

Number Format Precision

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.

"Buy Me A Coffee"

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
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-08