olegstan/safe-bc-math 问题修复 & 功能扩展

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

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

olegstan/safe-bc-math

Composer 安装命令:

composer require olegstan/safe-bc-math

包简介

Safe versions of BC math functions

README 文档

README

Installation

$ composer require backendtea/safe-bc-math

Why this package

Casting a float to a string does not always do what you think it does. Some locales may give unexpected results, and give a malformed string, or the number is cast to a scientific notationm for example: 1.0E-11. Which bcmath cant handle. Even if you do not manually cast it to a string, the bc math functions expect strings, and will cast it themselves.

This package will throw an exception telling you what error it encountered, instead of giving a warning bcmath function argument is not well-formed and returning a wrong error.

Usage

Replace any usage of bc math functions with the Backendtea\bc.. version.

e.g.

- bcadd($a, $b);
+ \BackEndTea\bcadd($a, $b);

Or even better, import the funtion:

+ use function BackEndTea\bcadd;

bcadd($a, $b);

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固